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

             Branch data     Line data    Source code
       1                 :             : #include "test_libmem_all.h"
       2                 :             : 
       3                 :             : /**
       4                 :             :  * @brief Capture the bounded-string negative case with a non-divisible source size
       5                 :             :  *
       6                 :             :  * @return Return describing success or failure
       7                 :             :  */
       8                 :           1 : static Return capture_libmem_invalid_bounded_string_size(void)
       9                 :             : {
      10                 :           1 :         INITTEST;
      11                 :             : 
      12                 :           1 :         m_create(uint32_t,code_units);
      13                 :             : 
      14                 :           1 :         const uint32_t initial_code_units[] = {
      15                 :             :                 UINT32_C(0x00010000),
      16                 :             :                 UINT32_C(0x00000000)
      17                 :             :         };
      18                 :           1 :         const unsigned char invalid_suffix[] = {0x11,0x22,0x33,0x44,0x55};
      19                 :             : 
      20                 :           1 :         ASSERT(SUCCESS == m_copy_buffer(code_units,sizeof(initial_code_units),initial_code_units));
      21                 :           1 :         ASSERT(SUCCESS == m_to_string(code_units));
      22                 :           1 :         ASSERT(FAILURE == m_concat_string(code_units,sizeof(invalid_suffix),invalid_suffix));
      23                 :           1 :         call(m_del(code_units));
      24                 :             : 
      25                 :           1 :         deliver(status);
      26                 :             : }
      27                 :             : 
      28                 :             : /**
      29                 :             :  * @brief Check bounded string concat rejects source sizes that do not fit whole elements
      30                 :             :  *
      31                 :             :  * @return Return describing success or failure
      32                 :             :  */
      33                 :           1 : Return test_libmem_0028(void)
      34                 :             : {
      35                 :           1 :         INITTEST;
      36                 :             : 
      37                 :             :         static const char expected_stderr_pattern_libmem_0028[] =
      38                 :             :                 "\\A.*not divisible by element size.*\\Z";
      39                 :             : 
      40                 :           1 :         ASSERT(SUCCESS == match_function_output(NULL,expected_stderr_pattern_libmem_0028,capture_libmem_invalid_bounded_string_size));
      41                 :             : 
      42                 :           1 :         RETURN_STATUS;
      43                 :             : }
        

Generated by: LCOV version 2.0-1