diff --git a/tests/src/fuzzer-parse_bjdata.cpp b/tests/src/fuzzer-parse_bjdata.cpp index d3c9e7a33..62a0609bf 100644 --- a/tests/src/fuzzer-parse_bjdata.cpp +++ b/tests/src/fuzzer-parse_bjdata.cpp @@ -11,15 +11,15 @@ This file implements a parser test suitable for fuzz testing. Given a byte array data, it performs the following steps: - j1 = from_bjdata(data) -- vec = to_bjdata(j1) -- j2 = from_bjdata(vec) -- assert(j1 == j2) -- vec2 = to_bjdata(j1, use_size = true, use_type = false) -- j3 = from_bjdata(vec2) -- assert(j1 == j3) -- vec3 = to_bjdata(j1, use_size = true, use_type = true) -- j4 = from_bjdata(vec3) -- assert(j1 == j4) +- vec2 = to_bjdata(j1, use_size = false, use_type = false) +- vec3 = to_bjdata(j1, use_size = true, use_type = false) +- vec4 = to_bjdata(j1, use_size = true, use_type = true) +- j2 = from_bjdata(vec2) +- j3 = from_bjdata(vec3) +- j4 = from_bjdata(vec4) +- assert(from_bjdata(to_bjdata(j2, use_size = false, use_type = false)) is value-stable with j2) +- assert(from_bjdata(to_bjdata(j3, use_size = true, use_type = false)) is value-stable with j3) +- assert(from_bjdata(to_bjdata(j4, use_size = true, use_type = true)) is value-stable with j4) Re-serializing j2/j3/j4 with the same use_size/use_type settings is checked for value-stability rather than byte-exact stability: from_bjdata(to_bjdata(j2)) @@ -50,8 +50,6 @@ drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away diff --git a/tests/src/fuzzer-parse_bon8.cpp b/tests/src/fuzzer-parse_bon8.cpp index e97d4f17b..416d91fd0 100644 --- a/tests/src/fuzzer-parse_bon8.cpp +++ b/tests/src/fuzzer-parse_bon8.cpp @@ -13,7 +13,7 @@ array data, it performs the following steps: - j1 = from_bon8(data) - vec = to_bon8(j1) - j2 = from_bon8(vec) -- assert(j1 == j2) +- assert(to_bon8(j2) == vec) It also checks that reading the data from a stream, which reads strings byte by byte, gives the same value or error as reading it from contiguous memory, which @@ -24,7 +24,6 @@ drivers. */ #include -#include #include #include diff --git a/tests/src/fuzzer-parse_bson.cpp b/tests/src/fuzzer-parse_bson.cpp index 16f36445b..86e0c38a5 100644 --- a/tests/src/fuzzer-parse_bson.cpp +++ b/tests/src/fuzzer-parse_bson.cpp @@ -13,15 +13,13 @@ array data, it performs the following steps: - j1 = from_bson(data) - vec = to_bson(j1) - j2 = from_bson(vec) -- assert(j1 == j2) +- assert(to_bson(j2) == vec) The provided function `LLVMFuzzerTestOneInput` can be used in different fuzzer drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away @@ -40,11 +38,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) std::vector const vec1(data, data + size); json const j1 = json::from_bson(vec1); - if (j1.is_discarded()) - { - return 0; - } - try { // step 2: round trip diff --git a/tests/src/fuzzer-parse_cbor.cpp b/tests/src/fuzzer-parse_cbor.cpp index 7d599abe2..3cc204d8b 100644 --- a/tests/src/fuzzer-parse_cbor.cpp +++ b/tests/src/fuzzer-parse_cbor.cpp @@ -13,15 +13,13 @@ array data, it performs the following steps: - j1 = from_cbor(data) - vec = to_cbor(j1) - j2 = from_cbor(vec) -- assert(j1 == j2) +- assert(to_cbor(j2) == vec) The provided function `LLVMFuzzerTestOneInput` can be used in different fuzzer drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away diff --git a/tests/src/fuzzer-parse_json.cpp b/tests/src/fuzzer-parse_json.cpp index 217d9e0fd..02ba16611 100644 --- a/tests/src/fuzzer-parse_json.cpp +++ b/tests/src/fuzzer-parse_json.cpp @@ -21,8 +21,6 @@ drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away diff --git a/tests/src/fuzzer-parse_msgpack.cpp b/tests/src/fuzzer-parse_msgpack.cpp index df961b8d7..343e5c0c2 100644 --- a/tests/src/fuzzer-parse_msgpack.cpp +++ b/tests/src/fuzzer-parse_msgpack.cpp @@ -13,15 +13,13 @@ array data, it performs the following steps: - j1 = from_msgpack(data) - vec = to_msgpack(j1) - j2 = from_msgpack(vec) -- assert(j1 == j2) +- assert(to_msgpack(j2) == vec) The provided function `LLVMFuzzerTestOneInput` can be used in different fuzzer drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away diff --git a/tests/src/fuzzer-parse_ubjson.cpp b/tests/src/fuzzer-parse_ubjson.cpp index ebf775b59..fcaf16061 100644 --- a/tests/src/fuzzer-parse_ubjson.cpp +++ b/tests/src/fuzzer-parse_ubjson.cpp @@ -11,15 +11,15 @@ This file implements a parser test suitable for fuzz testing. Given a byte array data, it performs the following steps: - j1 = from_ubjson(data) -- vec = to_ubjson(j1) -- j2 = from_ubjson(vec) -- assert(j1 == j2) -- vec2 = to_ubjson(j1, use_size = true, use_type = false) -- j3 = from_ubjson(vec2) -- assert(j1 == j3) -- vec3 = to_ubjson(j1, use_size = true, use_type = true) -- j4 = from_ubjson(vec3) -- assert(j1 == j4) +- vec2 = to_ubjson(j1, use_size = false, use_type = false) +- vec3 = to_ubjson(j1, use_size = true, use_type = false) +- vec4 = to_ubjson(j1, use_size = true, use_type = true) +- j2 = from_ubjson(vec2) +- j3 = from_ubjson(vec3) +- j4 = from_ubjson(vec4) +- assert(to_ubjson(j2, use_size = false, use_type = false) == vec2) +- assert(to_ubjson(j3, use_size = true, use_type = false) == vec3) +- assert(to_ubjson(j4, use_size = true, use_type = true) == vec4) The unit tests run the same checks on a fixed corpus (see the "UBJSON round-trip invariants" test case), so keep both in sync. @@ -29,8 +29,6 @@ drivers. */ #include -#include -#include #include // the round-trip checks below are assertions; NDEBUG would compile them away