LCOV - code coverage report
Current view: top level - libs/mem/tests/src - test_libmem_0023.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 29 29
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 string_length on multi-byte descriptors in both data and string mode
       5                 :             :  *
       6                 :             :  * @return Return describing success or failure
       7                 :             :  */
       8                 :           1 : Return test_libmem_0023(void)
       9                 :             : {
      10                 :           1 :         INITTEST;
      11                 :             : 
      12                 :           1 :         m_create(uint32_t,code_units);
      13                 :           1 :         size_t measured_length = 0;
      14                 :             : 
      15                 :           1 :         ASSERT(SUCCESS == m_resize(code_units,4));
      16                 :             : 
      17                 :           1 :         uint32_t *code_unit_view = m_data(uint32_t,code_units);
      18                 :           1 :         ASSERT(code_unit_view != NULL);
      19                 :             : 
      20                 :           1 :         IF(code_unit_view != NULL)
      21                 :             :         {
      22                 :           1 :                 code_unit_view[0] = UINT32_C(0x00010000);
      23                 :           1 :                 code_unit_view[1] = UINT32_C(0x01000000);
      24                 :           1 :                 code_unit_view[2] = UINT32_C(0x00000000);
      25                 :           1 :                 code_unit_view[3] = UINT32_C(0x00000002);
      26                 :             :         }
      27                 :             : 
      28                 :           1 :         ASSERT(SUCCESS == m_string_length(code_units,&measured_length));
      29                 :           1 :         ASSERT(measured_length == 2);
      30                 :             : 
      31                 :           1 :         ASSERT(SUCCESS == m_resize(code_units,3));
      32                 :             : 
      33                 :           1 :         code_unit_view = m_data(uint32_t,code_units);
      34                 :           1 :         ASSERT(code_unit_view != NULL);
      35                 :             : 
      36                 :           1 :         IF(code_unit_view != NULL)
      37                 :             :         {
      38                 :           1 :                 code_unit_view[0] = UINT32_C(0x00010000);
      39                 :           1 :                 code_unit_view[1] = UINT32_C(0x00000001);
      40                 :           1 :                 code_unit_view[2] = UINT32_C(0x00000002);
      41                 :             :         }
      42                 :             : 
      43                 :           1 :         ASSERT(SUCCESS == m_string_length(code_units,&measured_length));
      44                 :           1 :         ASSERT(measured_length == 3);
      45                 :             : 
      46                 :           1 :         code_units->string_length = 2;
      47                 :           1 :         code_units->is_string = true;
      48                 :             : 
      49                 :           1 :         ASSERT(SUCCESS == m_string_length(code_units,&measured_length));
      50                 :           1 :         ASSERT(measured_length == 2);
      51                 :             : 
      52                 :           1 :         call(m_del(code_units));
      53                 :             : 
      54                 :           1 :         RETURN_STATUS;
      55                 :             : }
        

Generated by: LCOV version 2.0-1