LCOV - code coverage report
Current view: top level - libs/bsw/transport/src - LogicalAddress.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 12 12
Test Date: 2026-06-18 08:29:03 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /********************************************************************************
       2              :  * Copyright (c) 2024 Accenture
       3              :  *
       4              :  * This program and the accompanying materials are made available under the
       5              :  * terms of the Apache License Version 2.0 which is available at
       6              :  * https://www.apache.org/licenses/LICENSE-2.0
       7              :  *
       8              :  * SPDX-License-Identifier: Apache-2.0
       9              :  ********************************************************************************/
      10              : 
      11              : #include "transport/LogicalAddress.h"
      12              : 
      13              : #include <etl/algorithm.h>
      14              : 
      15              : namespace transport
      16              : {
      17              : namespace addressfinder
      18              : {
      19              : ::etl::optional<LogicalAddress>
      20           10 : findBy2ByteAddress(::etl::span<LogicalAddress const> const& list, uint16_t const address)
      21              : {
      22           10 :     auto* const iter = etl::find_if(
      23              :         list.begin(),
      24              :         list.end(),
      25           19 :         [address](LogicalAddress const addr) -> bool { return addr.address2Byte == address; });
      26           10 :     if (iter != list.end())
      27              :     {
      28            5 :         return *iter;
      29              :     }
      30            5 :     return {};
      31              : }
      32              : 
      33              : ::etl::optional<LogicalAddress>
      34           17 : findBy1ByteAddress(::etl::span<LogicalAddress const> const& list, uint16_t const address)
      35              : {
      36           17 :     auto* const iter = etl::find_if(
      37              :         list.begin(),
      38              :         list.end(),
      39           37 :         [address](LogicalAddress const addr) -> bool { return addr.address1Byte == address; });
      40           17 :     if (iter != list.end())
      41              :     {
      42           10 :         return *iter;
      43              :     }
      44            7 :     return {};
      45              : }
      46              : } // namespace addressfinder
      47              : } // namespace transport
        

Generated by: LCOV version 2.0-1