GCC Code Coverage Report


Directory: src/gate/
File: src/gate/encode/tests/gateencode_test/test_csv.c
Date: 2026-12-03 19:36:00
Exec Total Coverage
Lines: 18 18 100.0%
Functions: 1 1 100.0%
Branches: 6 12 50.0%

Line Branch Exec Source
1 #include "gate/tests.h"
2 #include "test_csv.h"
3 #include "gate/encode/csv.h"
4
5 1 GATE_TEST_FUNCTION(test_csv)
6 {
7 1 gate_stringstream_t* ptr_ss = NULL;
8 1 gate_stream_t* ptr_stream = NULL;
9 1 gate_csv_reader_t reader = GATE_INIT_EMPTY;
10 char buffer[32];
11 1 gate_size_t buffer_used = 0;
12 gate_bool_t is_end_of_record;
13
14 1 GATE_TEST_UNIT_BEGIN(test_csv);
15
16 1 ptr_ss = gate_stringstream_create(256);
17
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 GATE_TEST_CHECK(ptr_ss != NULL);
18 1 ptr_stream = (gate_stream_t*)ptr_ss;
19
20 1 gate_stream_write_block(ptr_stream, "Hello World", 11, &buffer_used);
21
22
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 GATE_TEST_CHECK_OK(gate_csv_reader_create(&reader, ptr_stream, ';', '\"'));
23
24
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 GATE_TEST_CHECK_OK(gate_csv_reader_get_next_buffer(&reader, buffer, sizeof(buffer), &buffer_used, &is_end_of_record));
25
1/2
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
1 GATE_TEST_CHECK_EQUAL(buffer_used, 11);
26
1/2
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
1 GATE_TEST_CHECK(gate_str_compare(buffer, 11, "Hello World", 11) == 0);
27
28 1 gate_csv_reader_destroy(&reader);
29
1/2
✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
1 if (ptr_ss != NULL)
30 {
31 1 gate_object_release(ptr_ss);
32 }
33
34 1 GATE_TEST_UNIT_END;
35 }
36