Use less c++
As a design, it would be better if we didn't need to have a dependency
on c++ in a c library. Moving things to C will reduce both
dependencies and compile times.
Reduced dependencies makes the library itself easier to use in
more environments.
libmctp Is a library that doesn't take a dependency on gtest for its
tests
libpldm Is an example that does take a dependency on gtest.
Change-Id: If1dc638f87b75b28181a0baf67f5a18d389cff81
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/fuzz_cper_buf_to_ir.c b/tests/fuzz_cper_buf_to_ir.c
new file mode 100644
index 0000000..a9ff504
--- /dev/null
+++ b/tests/fuzz_cper_buf_to_ir.c
@@ -0,0 +1,21 @@
+#include <assert.h>
+#include "libcper/cper-parse.h"
+#include "test-utils.h"
+
+int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ json_object *ir = cper_buf_to_ir(data, size);
+ if (ir == NULL) {
+ return 0;
+ }
+
+ int valid = schema_validate_from_file(ir, 0 /* single_section */,
+ /*all_valid_bits*/ 0);
+ if (!valid) {
+ printf("JSON: %s\n", json_object_to_json_string(ir));
+ }
+ assert(valid);
+ json_object_put(ir);
+
+ return 0;
+}