Branch data Line data Source code
1 : : #include "test_libmem_all.h"
2 : :
3 : : /**
4 : : * @brief Capture the internal unbounded-source negative case past the logical end
5 : : *
6 : : * @return Return describing success or failure
7 : : */
8 : 1 : static Return capture_libmem_invalid_internal_unbounded_source(void)
9 : : {
10 : 1 : INITTEST;
11 : :
12 : : static const char base_text[] = "base";
13 : :
14 : 1 : m_create(char,string_buffer);
15 : 1 : ASSERT(SUCCESS == m_to_string(string_buffer));
16 : :
17 : 1 : ASSERT(SUCCESS == m_copy_fixed_string(string_buffer,sizeof(base_text),base_text));
18 : :
19 : 1 : const char *invalid_internal_source = m_text(string_buffer) + string_buffer->length;
20 : :
21 : 1 : ASSERT(invalid_internal_source != NULL);
22 : :
23 : 1 : IF(invalid_internal_source != NULL)
24 : : {
25 : 1 : ASSERT(FAILURE == mem_core_string(SOURCE_UNBOUNDED_STRING | TRANSFER_APPEND,string_buffer,0,invalid_internal_source));
26 : : }
27 : :
28 : 1 : call(m_del(string_buffer));
29 : :
30 : 1 : deliver(status);
31 : : }
32 : :
33 : : /**
34 : : * @brief Check internal unbounded mode rejects one-past-end logical pointers
35 : : *
36 : : * @return Return describing success or failure
37 : : */
38 : 1 : Return test_libmem_0033(void)
39 : : {
40 : 1 : INITTEST;
41 : :
42 : : static const char expected_stderr_pattern_libmem_0033[] =
43 : : "\\A.*Unbounded source start exceeds destination logical bounds.*\\Z";
44 : :
45 : 1 : ASSERT(SUCCESS == match_function_output(NULL,expected_stderr_pattern_libmem_0033,capture_libmem_invalid_internal_unbounded_source));
46 : :
47 : 1 : RETURN_STATUS;
48 : : }
|