LCOV - code coverage report
Current view: top level - libs/mem/tests/src - test_libmem_0054.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2026-07-12 01:01:34 Functions: 100.0 % 1 1
Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : #include "test_libmem_all.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Check guarded arithmetic helpers used by libmem internals
       5                 :             :  *
       6                 :             :  * The two negative cases mark their expected guard failures before
       7                 :             :  * provoking them, so the final telemetry summary can distinguish
       8                 :             :  * intentional coverage from unexpected arithmetic trouble
       9                 :             :  *
      10                 :             :  * @return Return describing success or failure
      11                 :             :  */
      12                 :           1 : Return test_libmem_0054(void)
      13                 :             : {
      14                 :           1 :         INITTEST;
      15                 :             : 
      16                 :           1 :         m_create(char,byte_buffer);
      17                 :           1 :         size_t result = 0;
      18                 :             : 
      19                 :           1 :         ASSERT(SUCCESS == m_guarded_byte_size(byte_buffer,16u,&result));
      20                 :           1 :         ASSERT(result == 16u);
      21                 :             : 
      22                 :           1 :         ASSERT(SUCCESS == m_guarded_add(10u,20u,&result));
      23                 :           1 :         ASSERT(result == 30u);
      24                 :             : 
      25                 :           1 :         ASSERT(SUCCESS == m_guarded_subtract(20u,10u,&result));
      26                 :           1 :         ASSERT(result == 10u);
      27                 :             : 
      28                 :           1 :         telemetry_expected_arithmetic_guard_failures();
      29                 :           1 :         ASSERT(FAILURE == m_guarded_add(SIZE_MAX,1u,&result));
      30                 :             : 
      31                 :           1 :         telemetry_expected_arithmetic_guard_failures();
      32                 :           1 :         ASSERT(FAILURE == m_guarded_subtract(0u,1u,&result));
      33                 :           1 :         call(m_del(byte_buffer));
      34                 :             : 
      35                 :           1 :         RETURN_STATUS;
      36                 :             : }
        

Generated by: LCOV version 2.0-1