Move print depth into printbuffer
This commit is contained in:
@@ -31,8 +31,8 @@ static void assert_print_array(const char * const expected, const char * const i
|
||||
|
||||
cJSON item[1];
|
||||
|
||||
printbuffer formatted_buffer;
|
||||
printbuffer unformatted_buffer;
|
||||
printbuffer formatted_buffer = { 0, 0, 0, 0, 0 };
|
||||
printbuffer unformatted_buffer = { 0, 0, 0, 0, 0 };
|
||||
|
||||
parse_buffer parsebuffer = { 0, 0, 0, 0 };
|
||||
parsebuffer.content = (const unsigned char*)input;
|
||||
@@ -53,10 +53,10 @@ static void assert_print_array(const char * const expected, const char * const i
|
||||
memset(item, 0, sizeof(item));
|
||||
TEST_ASSERT_TRUE_MESSAGE(parse_array(item, &parsebuffer, &global_hooks), "Failed to parse array.");
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_array(item, 0, false, &unformatted_buffer, &global_hooks), "Failed to print unformatted string.");
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_array(item, false, &unformatted_buffer, &global_hooks), "Failed to print unformatted string.");
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(input, printed_unformatted, "Unformatted array is not correct.");
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_array(item, 0, true, &formatted_buffer, &global_hooks), "Failed to print formatted string.");
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_array(item, true, &formatted_buffer, &global_hooks), "Failed to print formatted string.");
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, printed_formatted, "Formatted array is not correct.");
|
||||
|
||||
reset(item);
|
||||
|
||||
@@ -28,7 +28,7 @@ static void assert_print_number(const char *expected, double input)
|
||||
{
|
||||
unsigned char printed[1024];
|
||||
cJSON item[1];
|
||||
printbuffer buffer;
|
||||
printbuffer buffer = { 0, 0, 0, 0, 0 };
|
||||
buffer.buffer = printed;
|
||||
buffer.length = sizeof(printed);
|
||||
buffer.offset = 0;
|
||||
|
||||
@@ -31,8 +31,8 @@ static void assert_print_object(const char * const expected, const char * const
|
||||
|
||||
cJSON item[1];
|
||||
|
||||
printbuffer formatted_buffer;
|
||||
printbuffer unformatted_buffer;
|
||||
printbuffer formatted_buffer = { 0, 0, 0, 0, 0 };
|
||||
printbuffer unformatted_buffer = { 0, 0, 0, 0, 0 };
|
||||
parse_buffer parsebuffer = { 0, 0, 0, 0 };
|
||||
|
||||
/* buffer for parsing */
|
||||
@@ -54,10 +54,10 @@ static void assert_print_object(const char * const expected, const char * const
|
||||
memset(item, 0, sizeof(item));
|
||||
TEST_ASSERT_TRUE_MESSAGE(parse_object(item, &parsebuffer, &global_hooks), "Failed to parse object.");
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_object(item, 0, false, &unformatted_buffer, &global_hooks), "Failed to print unformatted string.");
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_object(item, false, &unformatted_buffer, &global_hooks), "Failed to print unformatted string.");
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(input, printed_unformatted, "Unformatted object is not correct.");
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_object(item, 0, true, &formatted_buffer, &global_hooks), "Failed to print formatted string.");
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_object(item, true, &formatted_buffer, &global_hooks), "Failed to print formatted string.");
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, printed_formatted, "Formatted ojbect is not correct.");
|
||||
|
||||
reset(item);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
static void assert_print_string(const char *expected, const char *input)
|
||||
{
|
||||
unsigned char printed[1024];
|
||||
printbuffer buffer;
|
||||
printbuffer buffer = { 0, 0, 0, 0, 0 };
|
||||
buffer.buffer = printed;
|
||||
buffer.length = sizeof(printed);
|
||||
buffer.offset = 0;
|
||||
|
||||
@@ -32,7 +32,7 @@ static void assert_print_value(const char *input)
|
||||
{
|
||||
unsigned char printed[1024];
|
||||
cJSON item[1];
|
||||
printbuffer buffer;
|
||||
printbuffer buffer = { 0, 0, 0, 0, 0 };
|
||||
parse_buffer parsebuffer = { 0, 0, 0, 0 };
|
||||
buffer.buffer = printed;
|
||||
buffer.length = sizeof(printed);
|
||||
@@ -46,7 +46,7 @@ static void assert_print_value(const char *input)
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(parse_value(item, &parsebuffer, &global_hooks), "Failed to parse value.");
|
||||
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_value(item, 0, false, &buffer, &global_hooks), "Failed to print value.");
|
||||
TEST_ASSERT_TRUE_MESSAGE(print_value(item, false, &buffer, &global_hooks), "Failed to print value.");
|
||||
TEST_ASSERT_EQUAL_STRING_MESSAGE(input, buffer.buffer, "Printed value is not as expected.");
|
||||
|
||||
reset(item);
|
||||
|
||||
Reference in New Issue
Block a user