LCOV - code coverage report
Current view: top level - libs/mem/tests/src - test_libmem_0025.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 23 23
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 data-to-string conversion adds a terminator for multi-byte payloads without one
       5                 :             :  *
       6                 :             :  * @return Return describing success or failure
       7                 :             :  */
       8                 :           1 : Return test_libmem_0025(void)
       9                 :             : {
      10                 :           1 :         INITTEST;
      11                 :             : 
      12                 :           1 :         m_create(uint32_t,code_units);
      13                 :             : 
      14                 :           1 :         ASSERT(SUCCESS == m_resize(code_units,3));
      15                 :             : 
      16                 :           1 :         uint32_t *code_unit_view = m_data(uint32_t,code_units);
      17                 :           1 :         ASSERT(code_unit_view != NULL);
      18                 :             : 
      19                 :           1 :         IF(code_unit_view != NULL)
      20                 :             :         {
      21                 :           1 :                 code_unit_view[0] = UINT32_C(0x00010000);
      22                 :           1 :                 code_unit_view[1] = UINT32_C(0x00000001);
      23                 :           1 :                 code_unit_view[2] = UINT32_C(0x00000002);
      24                 :             :         }
      25                 :             : 
      26                 :           1 :         ASSERT(SUCCESS == m_to_string(code_units));
      27                 :           1 :         ASSERT(code_units->length == 4);
      28                 :           1 :         ASSERT(code_units->string_length == 3);
      29                 :           1 :         ASSERT(code_units->is_string == true);
      30                 :             : 
      31                 :           1 :         const uint32_t *const_code_unit_view = m_data_ro(uint32_t,code_units);
      32                 :           1 :         ASSERT(const_code_unit_view != NULL);
      33                 :             : 
      34                 :           1 :         IF(const_code_unit_view != NULL)
      35                 :             :         {
      36                 :           1 :                 ASSERT(const_code_unit_view[0] == UINT32_C(0x00010000));
      37                 :           1 :                 ASSERT(const_code_unit_view[1] == UINT32_C(0x00000001));
      38                 :           1 :                 ASSERT(const_code_unit_view[2] == UINT32_C(0x00000002));
      39                 :           1 :                 ASSERT(const_code_unit_view[3] == UINT32_C(0x00000000));
      40                 :             :         }
      41                 :             : 
      42                 :           1 :         call(m_del(code_units));
      43                 :             : 
      44                 :           1 :         RETURN_STATUS;
      45                 :             : }
        

Generated by: LCOV version 2.0-1