LCOV - code coverage report
Current view: top level - libs/mem/tests/src - test_libmem_0001.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 15 15
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 that copying an empty data descriptor clears a populated destination
       5                 :             :  *
       6                 :             :  * Creates empty source and populated destination descriptors with unsigned long
       7                 :             :  * long int elements. Copying the empty source into the destination must clear
       8                 :             :  * its logical payload while preserving its data-mode metadata
       9                 :             :  *
      10                 :             :  * @return Return describing success or failure
      11                 :             :  */
      12                 :           1 : Return test_libmem_0001(void)
      13                 :             : {
      14                 :           1 :         INITTEST;
      15                 :             : 
      16                 :             :         // Create the source and destination descriptors
      17                 :           1 :         m_create(unsigned long long int,test0_0);
      18                 :           1 :         m_create(unsigned long long int,test0_1);
      19                 :             : 
      20                 :             :         // Keep the source empty and prepare a non-empty destination
      21                 :           1 :         ASSERT(SUCCESS == m_resize(test0_0,0));
      22                 :           1 :         ASSERT(test0_0->length == 0U);
      23                 :           1 :         ASSERT(SUCCESS == m_resize(test0_1,2));
      24                 :           1 :         ASSERT(test0_1->length == 2U);
      25                 :             : 
      26                 :             :         // Copying the empty source clears the destination payload
      27                 :           1 :         ASSERT(SUCCESS == m_copy(test0_1,test0_0));
      28                 :           1 :         ASSERT(test0_1->length == 0U);
      29                 :           1 :         ASSERT(test0_1->string_length == 0U);
      30                 :           1 :         ASSERT(test0_1->is_string == false);
      31                 :             : 
      32                 :             :         // Cleanup
      33                 :           1 :         call(m_del(test0_0));
      34                 :           1 :         call(m_del(test0_1));
      35                 :             : 
      36                 :           1 :         RETURN_STATUS;
      37                 :             : }
        

Generated by: LCOV version 2.0-1