Skip to content
Myr

Fix expected value assertion (fix #3430, ref #3393) (#3431)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by itchyny · committed by GitHub · parent cff4e00 · Browse files · 1 file+9 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−7 removed

  • other:+9 added−7 removed

1 file+9 added−7 removed

modified:src/jq_test.c+9 added-7 removed
1#include <assert.h>2#include <stdio.h>3#include <string.h>4#include <stdlib.h>5#include <math.h>5#ifdef HAVE_PTHREAD6#include <pthread.h>7#endif8#include "jv.h"
189 unmodified lines
198 printf(" for test at line number %u: %s\n", lineno, prog);199 pass = 0;200 }201#ifdef USE_DECNUM203 if (!(jv_get_kind(expected) == JV_KIND_NUMBER && isnan(jv_number_value(expected)))) {204 jv as_string = jv_dump_string(jv_copy(expected), rand() & ~(JV_PRINT_COLOR|JV_PRINT_REFCOUNT));205 jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string)));206 assert(jv_equal(jv_copy(expected), jv_copy(reparsed)));207 jv_free(as_string);208 jv_free(reparsed);202 jv as_string = jv_dump_string(jv_copy(expected), 0);203 jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string)));204 if (!jv_equal(jv_copy(expected), jv_copy(reparsed))) {205 printf("*** Expected result should be equal after reparsing, but got ");206 jv_dump(jv_copy(reparsed), 0);207 printf(" for test at line %u: %s\n", lineno, buf);208 pass = 0;209 }210 jv_free(as_string);211 jv_free(reparsed);212#endif213 jv_free(expected);214 jv_free(actual);215 }
352 unmodified lines