Matter SDK Coverage Report
Current view: top level - transport/raw - PeerAddress.cpp (source / functions) Coverage Total Hit
Test: SHA:5853f10e345717417494f970a7d13b422d94af51 Lines: 100.0 % 12 12
Test Date: 2025-06-30 07:09:23 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /*
       2              :  *
       3              :  *    Copyright (c) 2025 Project CHIP Authors
       4              :  *
       5              :  *    Licensed under the Apache License, Version 2.0 (the "License");
       6              :  *    you may not use this file except in compliance with the License.
       7              :  *    You may obtain a copy of the License at
       8              :  *
       9              :  *        http://www.apache.org/licenses/LICENSE-2.0
      10              :  *
      11              :  *    Unless required by applicable law or agreed to in writing, software
      12              :  *    distributed under the License is distributed on an "AS IS" BASIS,
      13              :  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      14              :  *    See the License for the specific language governing permissions and
      15              :  *    limitations under the License.
      16              :  */
      17              : 
      18              : /**
      19              :  * @brief
      20              :  *    File contains definitions on how a connection to a peer can be defined.
      21              :  *
      22              :  */
      23              : 
      24              : #include "PeerAddress.h"
      25              : 
      26              : namespace chip {
      27              : namespace Transport {
      28              : 
      29        15150 : bool PeerAddress::operator==(const PeerAddress & other) const
      30              : {
      31              :     // Compare common fields
      32        15150 :     if (mTransportType != other.mTransportType)
      33              :     {
      34            7 :         return false;
      35              :     }
      36              : 
      37              :     // Compare transport-type specific fields
      38        15143 :     switch (mTransportType)
      39              :     {
      40            2 :     case Type::kNfc:
      41            2 :         return (mId.mNFCShortId == other.mId.mNFCShortId);
      42              : 
      43        15091 :     case Type::kUdp:
      44              :     case Type::kTcp:
      45        15091 :         return (mIPAddress == other.mIPAddress && mPort == other.mPort && mInterface == other.mInterface);
      46              : 
      47            2 :     case Type::kWiFiPAF:
      48            2 :         return (mId.mRemoteId == other.mId.mRemoteId);
      49              : 
      50           48 :     case Type::kBle:
      51              :     default:
      52              :         // For transport types with no additional fields to compare
      53           48 :         return true;
      54              :     }
      55              : }
      56              : 
      57              : } // namespace Transport
      58              : } // namespace chip
        

Generated by: LCOV version 2.0-1