diff --git a/src/jq_test.c b/src/jq_test.c index a0120b7f..4a0bfe0d 100644 --- a/src/jq_test.c +++ b/src/jq_test.c @@ -2,7 +2,6 @@ #include #include #include -#include #ifdef HAVE_PTHREAD #include #endif @@ -200,13 +199,16 @@ static void run_jq_tests(jv lib_dirs, int verbose, FILE *testdata, int skip, int pass = 0; } #ifdef USE_DECNUM - if (!(jv_get_kind(expected) == JV_KIND_NUMBER && isnan(jv_number_value(expected)))) { - jv as_string = jv_dump_string(jv_copy(expected), rand() & ~(JV_PRINT_COLOR|JV_PRINT_REFCOUNT)); - jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string))); - assert(jv_equal(jv_copy(expected), jv_copy(reparsed))); - jv_free(as_string); - jv_free(reparsed); + jv as_string = jv_dump_string(jv_copy(expected), 0); + jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string))); + if (!jv_equal(jv_copy(expected), jv_copy(reparsed))) { + printf("*** Expected result should be equal after reparsing, but got "); + jv_dump(jv_copy(reparsed), 0); + printf(" for test at line %u: %s\n", lineno, buf); + pass = 0; } + jv_free(as_string); + jv_free(reparsed); #endif jv_free(expected); jv_free(actual);