From 49c3721a5a1b7e561f27e7cfcfac250a9d9b6f8b Mon Sep 17 00:00:00 2001 From: Eric Haszlakiewicz Date: Mon, 30 May 2022 15:39:54 +0000 Subject: [PATCH] Unset NDEBUG so assert() is enabled in all tests. One more fix there when building with -DCMAKE_BUILD_TYPE=release. --- tests/parse_flags.c | 3 +++ tests/test1.c | 3 +++ tests/test2.c | 3 +++ tests/test4.c | 3 +++ tests/testReplaceExisting.c | 3 +++ tests/test_cast.c | 3 +++ tests/test_charcase.c | 3 +++ tests/test_compare.c | 3 +++ tests/test_double_serializer.c | 3 +++ tests/test_float.c | 3 +++ tests/test_int_add.c | 3 +++ tests/test_locale.c | 3 +++ tests/test_null.c | 3 +++ tests/test_object_iterator.c | 3 +++ tests/test_parse.c | 4 ++++ tests/test_parse_int64.c | 3 +++ tests/test_printbuf.c | 3 +++ tests/test_set_serializer.c | 3 +++ tests/test_set_value.c | 3 +++ tests/test_strerror.c | 3 +++ tests/test_util_file.c | 3 +++ tests/test_visit.c | 3 +++ 22 files changed, 67 insertions(+) diff --git a/tests/parse_flags.c b/tests/parse_flags.c index d0a71bc0..6224ca31 100644 --- a/tests/parse_flags.c +++ b/tests/parse_flags.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include diff --git a/tests/test1.c b/tests/test1.c index 4d296014..01796ab3 100644 --- a/tests/test1.c +++ b/tests/test1.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test2.c b/tests/test2.c index 209fa261..0a5f3153 100644 --- a/tests/test2.c +++ b/tests/test2.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test4.c b/tests/test4.c index 288cec17..749459dc 100644 --- a/tests/test4.c +++ b/tests/test4.c @@ -2,6 +2,9 @@ * gcc -o utf8 utf8.c -I/home/y/include -L./.libs -ljson */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include #include diff --git a/tests/testReplaceExisting.c b/tests/testReplaceExisting.c index ee3cae0e..60a194ac 100644 --- a/tests/testReplaceExisting.c +++ b/tests/testReplaceExisting.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_cast.c b/tests/test_cast.c index fc769f51..276b4613 100644 --- a/tests/test_cast.c +++ b/tests/test_cast.c @@ -3,6 +3,9 @@ * Also checks the json_object_get_type and json_object_is_type functions. */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include #include diff --git a/tests/test_charcase.c b/tests/test_charcase.c index 208a7828..c6e783ee 100644 --- a/tests/test_charcase.c +++ b/tests/test_charcase.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_compare.c b/tests/test_compare.c index 6708445f..ed697cd1 100644 --- a/tests/test_compare.c +++ b/tests/test_compare.c @@ -2,6 +2,9 @@ * Tests if json_object_equal behaves correct. */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include #include diff --git a/tests/test_double_serializer.c b/tests/test_double_serializer.c index 65c7028f..59e95c2f 100644 --- a/tests/test_double_serializer.c +++ b/tests/test_double_serializer.c @@ -2,6 +2,9 @@ * Tests if the format string for double serialization is handled correctly */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include diff --git a/tests/test_float.c b/tests/test_float.c index 99b2b1cf..68a763d2 100644 --- a/tests/test_float.c +++ b/tests/test_float.c @@ -1,5 +1,8 @@ /* Copyright (C) 2016 by Rainer Gerhards * Released under ASL 2.0 */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include "json_object.h" #include "json_tokener.h" diff --git a/tests/test_int_add.c b/tests/test_int_add.c index 644aed90..142feacb 100644 --- a/tests/test_int_add.c +++ b/tests/test_int_add.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include diff --git a/tests/test_locale.c b/tests/test_locale.c index 55c9cc6e..7299ee27 100644 --- a/tests/test_locale.c +++ b/tests/test_locale.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_null.c b/tests/test_null.c index 0a2275b5..d2a0ddc6 100644 --- a/tests/test_null.c +++ b/tests/test_null.c @@ -2,6 +2,9 @@ * Tests if binary strings are supported. */ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include #include diff --git a/tests/test_object_iterator.c b/tests/test_object_iterator.c index da5192ab..4928088e 100644 --- a/tests/test_object_iterator.c +++ b/tests/test_object_iterator.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "config.h" #include #include diff --git a/tests/test_parse.c b/tests/test_parse.c index 34dd594d..6ddb2018 100644 --- a/tests/test_parse.c +++ b/tests/test_parse.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include @@ -42,6 +45,7 @@ static void single_incremental_parse(const char *test_string, int clear_serializ json_object *all_at_once_obj, *new_obj; const char *all_at_once_str, *new_str; + new_obj = NULL; assert(chunksize > 0); all_at_once_obj = json_tokener_parse(test_string); if (clear_serializer) diff --git a/tests/test_parse_int64.c b/tests/test_parse_int64.c index 446cc3dc..5710b080 100644 --- a/tests/test_parse_int64.c +++ b/tests/test_parse_int64.c @@ -1,4 +1,7 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include diff --git a/tests/test_printbuf.c b/tests/test_printbuf.c index d0fb918d..2a2ccc0e 100644 --- a/tests/test_printbuf.c +++ b/tests/test_printbuf.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_set_serializer.c b/tests/test_set_serializer.c index 06afdf23..27598f40 100644 --- a/tests/test_set_serializer.c +++ b/tests/test_set_serializer.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_set_value.c b/tests/test_set_value.c index 157e64f7..f51a2a5b 100644 --- a/tests/test_set_value.c +++ b/tests/test_set_value.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include diff --git a/tests/test_strerror.c b/tests/test_strerror.c index 17805644..57b051f1 100644 --- a/tests/test_strerror.c +++ b/tests/test_strerror.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "strerror_override.h" #include "strerror_override_private.h" diff --git a/tests/test_util_file.c b/tests/test_util_file.c index 9150586e..d0cb8a11 100644 --- a/tests/test_util_file.c +++ b/tests/test_util_file.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include "strerror_override.h" #include "strerror_override_private.h" #ifdef WIN32 diff --git a/tests/test_visit.c b/tests/test_visit.c index eee469e8..3283a559 100644 --- a/tests/test_visit.c +++ b/tests/test_visit.c @@ -1,3 +1,6 @@ +#ifdef NDEBUG +#undef NDEBUG +#endif #include #include #include -- 2.47.2