MCPcopy Create free account
hub / github.com/DaveGamble/cJSON / assert_print_value

Function assert_print_value

tests/print_value.c:31–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29#include "common.h"
30
31static void assert_print_value(const char *input)
32{
33 unsigned char printed[1024];
34 cJSON item[1];
35 printbuffer buffer = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
36 parse_buffer parsebuffer = { 0, 0, 0, 0, { 0, 0, 0 } };
37 buffer.buffer = printed;
38 buffer.length = sizeof(printed);
39 buffer.offset = 0;
40 buffer.noalloc = true;
41 buffer.hooks = global_hooks;
42
43 parsebuffer.content = (const unsigned char*)input;
44 parsebuffer.length = strlen(input) + sizeof("");
45 parsebuffer.hooks = global_hooks;
46
47 memset(item, 0, sizeof(item));
48
49 TEST_ASSERT_TRUE_MESSAGE(parse_value(item, &parsebuffer), "Failed to parse value.");
50
51 TEST_ASSERT_TRUE_MESSAGE(print_value(item, &buffer), "Failed to print value.");
52 TEST_ASSERT_EQUAL_STRING_MESSAGE(input, buffer.buffer, "Printed value is not as expected.");
53
54 reset(item);
55}
56
57static void print_value_should_print_null(void)
58{

Calls 3

parse_valueFunction · 0.85
print_valueFunction · 0.85
resetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…