LCOV - code coverage report
Current view: top level - libs/mem/tests/src - test_libmem_0052.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 26 26
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 m_copy_buffer with string and typed payloads
       5                 :             :  *
       6                 :             :  * @return Return describing success or failure
       7                 :             :  */
       8                 :           1 : Return test_libmem_0052(void)
       9                 :             : {
      10                 :           1 :         INITTEST;
      11                 :             : 
      12                 :           1 :         m_create(char,db_path);
      13                 :           1 :         m_create(point,point_buffer);
      14                 :             : 
      15                 :           1 :         const char in_memory_db_path[] = ":memory:";
      16                 :           1 :         const point sample_points[] = {
      17                 :             :                 {3,4},
      18                 :             :                 {5,6}
      19                 :             :         };
      20                 :             : 
      21                 :           1 :         ASSERT(SUCCESS == m_copy_buffer(db_path,sizeof(in_memory_db_path),in_memory_db_path));
      22                 :           1 :         ASSERT(db_path->length == sizeof(in_memory_db_path));
      23                 :           1 :         ASSERT(db_path->string_length == 0);
      24                 :           1 :         ASSERT(db_path->is_string == false);
      25                 :             : 
      26                 :           1 :         ASSERT(SUCCESS == m_copy_buffer(point_buffer,sizeof(sample_points),sample_points));
      27                 :             : 
      28                 :           1 :         const point *point_view = m_data_ro(point,point_buffer);
      29                 :           1 :         ASSERT(point_view != NULL);
      30                 :             : 
      31                 :           1 :         IF(point_view != NULL)
      32                 :             :         {
      33                 :           1 :                 ASSERT(point_buffer->length == 2);
      34                 :           1 :                 ASSERT(point_view[0].x == 3);
      35                 :           1 :                 ASSERT(point_view[0].y == 4);
      36                 :           1 :                 ASSERT(point_view[1].x == 5);
      37                 :           1 :                 ASSERT(point_view[1].y == 6);
      38                 :             :         }
      39                 :             : 
      40                 :           1 :         ASSERT(point_buffer->string_length == 0);
      41                 :           1 :         ASSERT(point_buffer->is_string == false);
      42                 :           1 :         ASSERT(SUCCESS == m_copy_buffer(point_buffer,0,NULL));
      43                 :           1 :         ASSERT(point_buffer->length == 0);
      44                 :           1 :         call(m_del(db_path));
      45                 :           1 :         call(m_del(point_buffer));
      46                 :             : 
      47                 :           1 :         RETURN_STATUS;
      48                 :             : }
        

Generated by: LCOV version 2.0-1