Remove gtest

It would be useful to be able to run libcper decoding unit tests without
needing a C compiler, as would be required if this were compiled to a
python module.

Change-Id: I183bc9ef048c336205186ea449e15b7766b19990
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/meson.build b/meson.build
index 96e194c..4240cd3 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 project(
     'libcper',
-    ['c', 'cpp'],
+    'c',
     version: '0.1',
     meson_version: '>=1.1.1',
     default_options: [
@@ -12,22 +12,21 @@
     ],
 )
 
+spec_dir = meson.current_source_dir() + '/specification/json'
+example_dir = meson.current_source_dir() + '/examples'
 add_project_arguments(
-    '-DLIBCPER_JSON_SPEC="'
-    + meson.current_source_dir() + '/specification/json"',
-    language: ['c', 'cpp'],
+    [
+        '-DLIBCPER_EXAMPLES="' + example_dir + '"',
+        '-DLIBCPER_JSON_SPEC="' + spec_dir + '"',
+        '-D_POSIX_C_SOURCE=200809L',
+    ],
+    language: 'c',
 )
 
-add_project_arguments('-DLIBCPER_EXAMPLES="'
-    + meson.current_source_dir() + '/examples"', language: ['c', 'cpp'])
-
-add_project_arguments('-Wno-unused-function', language: ['c', 'cpp'])
-
 library_is_share = get_option('default_library') == 'shared'
-add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c')
 
 if get_option('output-all-properties').enabled()
-    add_project_arguments('-DOUTPUT_ALL_PROPERTIES', language: ['c', 'cpp'])
+    add_project_arguments('-DOUTPUT_ALL_PROPERTIES', language: 'c')
 endif
 
 project_description = 'libcper library'
diff --git a/subprojects/packagefiles/jsoncdac/meson.build b/subprojects/packagefiles/jsoncdac/meson.build
index 6cc3bfc..f7af58f 100644
--- a/subprojects/packagefiles/jsoncdac/meson.build
+++ b/subprojects/packagefiles/jsoncdac/meson.build
@@ -2,7 +2,7 @@
     'libjsoncdac',
     ['c'],
     meson_version: '>=1.1.1',
-    default_options: ['default_library=static', 'c_std=gnu23'],
+    default_options: ['default_library=static', 'c_std=gnu18'],
 )
 conf_data = configuration_data(
     {
diff --git a/tests/base64_test.c b/tests/base64_test.c
new file mode 100644
index 0000000..abc540c
--- /dev/null
+++ b/tests/base64_test.c
@@ -0,0 +1,27 @@
+#include <libcper/base64.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+
+void test_base64_encode_good()
+{
+	int32_t encoded_len = 0;
+	const char *data = "f";
+	char *encoded = base64_encode((unsigned char *)data, strlen(data),
+				      &encoded_len);
+	assert(encoded_len == 4);
+	assert(memcmp(encoded, "Zg==", encoded_len) == 0);
+	free(encoded);
+}
+
+void test_base64_decode_good()
+{
+	int32_t decoded_len = 0;
+	const char *data = "Zg==";
+	UINT8 *decoded = base64_decode(data, strlen(data), &decoded_len);
+	assert(decoded_len == 1);
+	assert(decoded[0] == 'f');
+	free(decoded);
+}
diff --git a/tests/base64_test.cpp b/tests/base64_test.cpp
deleted file mode 100644
index 058de81..0000000
--- a/tests/base64_test.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <libcper/base64.h>
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-
-TEST(Base64Encode, Good)
-{
-	int32_t encoded_len = 0;
-	std::array<uint8_t, 1> data = { 'f' };
-	char *encoded = base64_encode(data.data(), data.size(), &encoded_len);
-	EXPECT_EQ(encoded_len, 4);
-	ASSERT_TRUE(memcmp(encoded, "Zg==", encoded_len) == 0);
-	free(encoded);
-}
-
-TEST(Base64Decode, Good)
-{
-	int32_t decoded_len = 0;
-	const char *data{ "Zg==" };
-	UINT8 *decoded = base64_decode(data, strlen(data), &decoded_len);
-	EXPECT_EQ(decoded_len, 1);
-	ASSERT_EQ(decoded[0], 'f');
-	free(decoded);
-}
diff --git a/tests/base64_test.h b/tests/base64_test.h
new file mode 100644
index 0000000..9e44d6f
--- /dev/null
+++ b/tests/base64_test.h
@@ -0,0 +1,2 @@
+void test_base64_encode_good();
+void test_base64_decode_good();
diff --git a/tests/ir-tests.cpp b/tests/ir-tests.c
similarity index 69%
rename from tests/ir-tests.cpp
rename to tests/ir-tests.c
index 37ee830..a0a0db1 100644
--- a/tests/ir-tests.cpp
+++ b/tests/ir-tests.c
@@ -4,8 +4,10 @@
  * Author: Lawrence.Tang@arm.com
  **/
 
-#include <gtest/gtest.h>
 #include "test-utils.h"
+#include "string.h"
+#include "assert.h"
+#include <ctype.h>
 #include <json.h>
 #include <libcper/cper-parse.h>
 #include <libcper/generator/cper-generate.h>
@@ -13,7 +15,7 @@
 #include <libcper/json-schema.h>
 #include <libcper/sections/cper-section.h>
 
-namespace fs = std::filesystem;
+#include "base64_test.h"
 
 /*
 * Test templates.
@@ -30,7 +32,7 @@
 	char *json_out;
 };
 
-void free_file_info(file_info *info)
+void free_file_info(struct file_info *info)
 {
 	if (info == NULL) {
 		return;
@@ -40,14 +42,14 @@
 	free(info);
 }
 
-file_info *file_info_init(const char *section_name)
+struct file_info *file_info_init(const char *section_name)
 {
-	file_info *info = NULL;
+	struct file_info *info = NULL;
 	char *buf = NULL;
 	size_t size;
 	int ret;
 
-	info = (file_info *)calloc(1, sizeof(file_info));
+	info = (struct file_info *)calloc(1, sizeof(struct file_info));
 	if (info == NULL) {
 		goto fail;
 	}
@@ -86,10 +88,10 @@
 	size_t size;
 	size_t file_size;
 	FILE *outFile = NULL;
-	std::vector<unsigned char> file_data;
+	unsigned char *file_data;
 	FILE *record = NULL;
 	char *buf = NULL;
-	file_info *info = file_info_init(section_name);
+	struct file_info *info = file_info_init(section_name);
 	if (info == NULL) {
 		goto done;
 	}
@@ -100,23 +102,23 @@
 	// Write example CPER to disk
 	outFile = fopen(info->cper_out, "wb");
 	if (outFile == NULL) {
-		std::cerr << "Failed to create/open CPER output file: "
-			  << info->cper_out << std::endl;
+		printf("Failed to create/open CPER output file: %s\n",
+		       info->cper_out);
 		goto done;
 	}
 
 	fseek(record, 0, SEEK_END);
 	file_size = ftell(record);
 	rewind(record);
-	file_data.resize(file_size);
-	if (fread(file_data.data(), 1, file_data.size(), record) != file_size) {
-		std::cerr << "Failed to read CPER data from memstream."
-			  << std::endl;
-		EXPECT_EQ(false, true);
+	file_data = malloc(file_size);
+	if (fread(file_data, 1, file_size, record) != file_size) {
+		printf("Failed to read CPER data from memstream.");
 		fclose(outFile);
+		assert(0);
+
 		goto done;
 	}
-	for (size_t index = 0; index < file_data.size(); index++) {
+	for (size_t index = 0; index < file_size; index++) {
 		char hex_str[3];
 		int out = snprintf(hex_str, sizeof(hex_str), "%02x",
 				   file_data[index]);
@@ -135,8 +137,8 @@
 	rewind(record);
 	ir = cper_to_ir(record);
 	if (ir == NULL) {
-		std::cerr << "Empty JSON from CPER bin" << std::endl;
-		EXPECT_EQ(false, true);
+		printf("Empty JSON from CPER bin2\n");
+		assert(0);
 		goto done;
 	}
 
@@ -169,10 +171,14 @@
 	return -1;
 }
 
-std::vector<unsigned char> string_to_binary(const char *source, size_t length)
+int string_to_binary(const char *source, size_t length, unsigned char **retval)
 {
-	std::vector<unsigned char> retval;
-	bool uppernibble = true;
+	size_t retval_size = length * 2;
+	*retval = malloc(retval_size);
+	int uppernibble = 1;
+
+	size_t ret_index = 0;
+
 	for (size_t i = 0; i < length; i++) {
 		char c = source[i];
 		if (c == '\n') {
@@ -181,34 +187,34 @@
 		int val = hex2int(c);
 		if (val < 0) {
 			printf("Invalid hex character in test file: %c\n", c);
-			return {};
+			return -1;
 		}
 
 		if (uppernibble) {
-			retval.push_back((unsigned char)(val << 4));
+			(*retval)[ret_index] = (unsigned char)(val << 4);
 		} else {
-			retval.back() += (unsigned char)val;
+			(*retval)[ret_index] += (unsigned char)val;
+			ret_index++;
 		}
 		uppernibble = !uppernibble;
 	}
-	return retval;
+	return ret_index;
 }
 
 //Tests fixed CPER sections for IR validity with an example set.
 void cper_example_section_ir_test(const char *section_name)
 {
 	//Open CPER record for the given type.
-	file_info *info = file_info_init(section_name);
+	struct file_info *info = file_info_init(section_name);
 	if (info == NULL) {
 		return;
 	}
 
 	FILE *cper_file = fopen(info->cper_out, "rb");
 	if (cper_file == NULL) {
-		std::cerr << "Failed to open CPER file: " << info->cper_out
-			  << std::endl;
+		printf("Failed to open CPER file: %s\n", info->cper_out);
 		free_file_info(info);
-		FAIL() << "Failed to open CPER file";
+		assert(0);
 		return;
 	}
 	fseek(cper_file, 0, SEEK_END);
@@ -220,40 +226,51 @@
 		return;
 	}
 	if (fread(buffer, 1, length, cper_file) != length) {
-		std::cerr << "Failed to read CPER file: " << info->cper_out
-			  << std::endl;
+		printf("Failed to read CPER file: %s\n", info->cper_out);
 		free(buffer);
 		free_file_info(info);
 		return;
 	}
 	fclose(cper_file);
 
-	std::vector<unsigned char> cper_bin = string_to_binary(buffer, length);
-	//Convert to IR, free resources.
-	json_object *ir = cper_buf_to_ir(cper_bin.data(), cper_bin.size());
-	if (ir == NULL) {
-		std::cerr << "Empty JSON from CPER bin" << std::endl;
+	unsigned char *cper_bin;
+	int cper_bin_len = string_to_binary(buffer, length, &cper_bin);
+	if (cper_bin_len <= 0) {
 		free(buffer);
 		free_file_info(info);
-		FAIL();
+		assert(0);
+		return;
+	}
+	printf("cper_bin: %s\n", cper_bin);
+	printf("cper_bin_len: %d\n", cper_bin_len);
+
+	//Convert to IR, free resources.
+	json_object *ir = cper_buf_to_ir(cper_bin, cper_bin_len);
+	if (ir == NULL) {
+		printf("Empty JSON from CPER bin3\n");
+		free(cper_bin);
+		free(buffer);
+		free_file_info(info);
+		assert(0);
 		return;
 	}
 
 	json_object *expected = json_object_from_file(info->json_out);
-	EXPECT_NE(expected, nullptr);
-	if (expected == nullptr) {
+	assert(expected != NULL);
+	if (expected == NULL) {
 		free(buffer);
+		free(cper_bin);
 		free_file_info(info);
 		const char *str = json_object_to_json_string(ir);
 
 		const char *expected_str = json_object_to_json_string(expected);
-
-		EXPECT_EQ(str, expected_str);
+		assert(strcmp(str, expected_str) == 0);
 		return;
 	}
 
-	EXPECT_TRUE(json_object_equal(ir, expected));
+	assert(json_object_equal(ir, expected));
 	free(buffer);
+	free(cper_bin);
 	json_object_put(ir);
 	json_object_put(expected);
 	free_file_info(info);
@@ -284,9 +301,12 @@
 	int valid = schema_validate_from_file(ir, single_section,
 					      /*all_valid_bits*/ 1);
 	json_object_put(ir);
-	EXPECT_GE(valid, 0)
-		<< "IR validation test failed (single section mode = "
-		<< single_section << ")\n";
+
+	if (valid < 0) {
+		printf("IR validation test failed (single section mode = %d)\n",
+		       single_section);
+		assert(0);
+	}
 }
 
 int to_hex(const unsigned char *input, size_t size, char **out)
@@ -322,8 +342,7 @@
 	FILE *record = generate_record_memstream(&section_name, 1, &buf, &size,
 						 single_section, validBitsType);
 	if (record == NULL) {
-		std::cerr << "Could not generate memstream for binary test"
-			  << std::endl;
+		printf("Could not generate memstream for binary test");
 		return;
 	}
 
@@ -354,15 +373,12 @@
 	int cper_buf_hex_len =
 		to_hex((unsigned char *)cper_buf, cper_buf_size, &cper_buf_hex);
 
-	EXPECT_EQ(buf_hex_len, cper_buf_hex_len);
-	if (buf_hex_len == cper_buf_hex_len) {
-		EXPECT_EQ(memcmp(buf_hex, cper_buf_hex, buf_hex_len), 0)
-			<< "Binary output was not identical to input (single section mode = "
-			<< single_section << ").";
-	}
+	assert(buf_hex_len == cper_buf_hex_len);
+	assert(memcmp(buf_hex, cper_buf_hex, buf_hex_len) == 0);
 
-	free(cper_buf_hex);
 	free(buf_hex);
+	free(cper_buf_hex);
+
 	//Free everything up.
 	fclose(record);
 	free(buf);
@@ -389,31 +405,26 @@
 /*
 * Non-single section assertions.
 */
-TEST(CompileTimeAssertions, TwoWayConversion)
+void CompileTimeAssertions_TwoWayConversion()
 {
 	for (size_t i = 0; i < section_definitions_len; i++) {
 		//If a conversion one way exists, a conversion the other way must exist.
-		const char *err =
-			"If a CPER conversion exists one way, there must be an equivalent method in reverse.";
 		if (section_definitions[i].ToCPER != NULL) {
-			ASSERT_NE(section_definitions[i].ToIR, nullptr) << err;
+			assert(section_definitions[i].ToIR != NULL);
 		}
 		if (section_definitions[i].ToIR != NULL) {
-			ASSERT_NE(section_definitions[i].ToCPER, nullptr)
-				<< err;
+			assert(section_definitions[i].ToCPER != NULL);
 		}
 	}
 }
 
-TEST(CompileTimeAssertions, ShortcodeNoSpaces)
+void CompileTimeAssertions_ShortcodeNoSpaces()
 {
 	for (size_t i = 0; i < generator_definitions_len; i++) {
 		for (int j = 0;
 		     generator_definitions[i].ShortName[j + 1] != '\0'; j++) {
-			ASSERT_FALSE(
-				isspace(generator_definitions[i].ShortName[j]))
-				<< "Illegal space character detected in shortcode '"
-				<< generator_definitions[i].ShortName << "'.";
+			assert(isspace(generator_definitions[i].ShortName[j]) ==
+			       0);
 		}
 	}
 }
@@ -423,181 +434,181 @@
 */
 
 //Generic processor tests.
-TEST(GenericProcessorTests, IRValid)
+void GenericProcessorTests_IRValid()
 {
 	cper_log_section_dual_ir_test("generic");
 }
-TEST(GenericProcessorTests, BinaryEqual)
+void GenericProcessorTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("generic");
 }
 
 //IA32/x64 tests.
-TEST(IA32x64Tests, IRValid)
+void IA32x64Tests_IRValid()
 {
 	cper_log_section_dual_ir_test("ia32x64");
 }
-TEST(IA32x64Tests, BinaryEqual)
+void IA32x64Tests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("ia32x64");
 }
 
-// TEST(IPFTests, IRValid) {
+// void IPFTests_IRValid() {
 //     cper_log_section_dual_ir_test("ipf");
 // }
 
 //ARM tests.
-TEST(ArmTests, IRValid)
+void ArmTests_IRValid()
 {
 	cper_log_section_dual_ir_test("arm");
 }
-TEST(ArmTests, BinaryEqual)
+void ArmTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("arm");
 }
 
 //Memory tests.
-TEST(MemoryTests, IRValid)
+void MemoryTests_IRValid()
 {
 	cper_log_section_dual_ir_test("memory");
 }
-TEST(MemoryTests, BinaryEqual)
+void MemoryTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("memory");
 }
 
 //Memory 2 tests.
-TEST(Memory2Tests, IRValid)
+void Memory2Tests_IRValid()
 {
 	cper_log_section_dual_ir_test("memory2");
 }
-TEST(Memory2Tests, BinaryEqual)
+void Memory2Tests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("memory2");
 }
 
 //PCIe tests.
-TEST(PCIeTests, IRValid)
+void PCIeTests_IRValid()
 {
 	cper_log_section_dual_ir_test("pcie");
 }
-TEST(PCIeTests, BinaryEqual)
+void PCIeTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("pcie");
 }
 
 //Firmware tests.
-TEST(FirmwareTests, IRValid)
+void FirmwareTests_IRValid()
 {
 	cper_log_section_dual_ir_test("firmware");
 }
-TEST(FirmwareTests, BinaryEqual)
+void FirmwareTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("firmware");
 }
 
 //PCI Bus tests.
-TEST(PCIBusTests, IRValid)
+void PCIBusTests_IRValid()
 {
 	cper_log_section_dual_ir_test("pcibus");
 }
-TEST(PCIBusTests, BinaryEqual)
+void PCIBusTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("pcibus");
 }
 
 //PCI Device tests.
-TEST(PCIDevTests, IRValid)
+void PCIDevTests_IRValid()
 {
 	cper_log_section_dual_ir_test("pcidev");
 }
-TEST(PCIDevTests, BinaryEqual)
+void PCIDevTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("pcidev");
 }
 
 //Generic DMAr tests.
-TEST(DMArGenericTests, IRValid)
+void DMArGenericTests_IRValid()
 {
 	cper_log_section_dual_ir_test("dmargeneric");
 }
-TEST(DMArGenericTests, BinaryEqual)
+void DMArGenericTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("dmargeneric");
 }
 
 //VT-d DMAr tests.
-TEST(DMArVtdTests, IRValid)
+void DMArVtdTests_IRValid()
 {
 	cper_log_section_dual_ir_test("dmarvtd");
 }
-TEST(DMArVtdTests, BinaryEqual)
+void DMArVtdTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("dmarvtd");
 }
 
 //IOMMU DMAr tests.
-TEST(DMArIOMMUTests, IRValid)
+void DMArIOMMUTests_IRValid()
 {
 	cper_log_section_dual_ir_test("dmariommu");
 }
-TEST(DMArIOMMUTests, BinaryEqual)
+void DMArIOMMUTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("dmariommu");
 }
 
 //CCIX PER tests.
-TEST(CCIXPERTests, IRValid)
+void CCIXPERTests_IRValid()
 {
 	cper_log_section_dual_ir_test("ccixper");
 }
-TEST(CCIXPERTests, BinaryEqual)
+void CCIXPERTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("ccixper");
 }
 
 //CXL Protocol tests.
-TEST(CXLProtocolTests, IRValid)
+void CXLProtocolTests_IRValid()
 {
 	cper_log_section_dual_ir_test("cxlprotocol");
 }
-TEST(CXLProtocolTests, BinaryEqual)
+void CXLProtocolTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("cxlprotocol");
 }
 
 //CXL Component tests.
-TEST(CXLComponentTests, IRValid)
+void CXLComponentTests_IRValid()
 {
 	cper_log_section_dual_ir_test("cxlcomponent-media");
 }
-TEST(CXLComponentTests, BinaryEqual)
+void CXLComponentTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("cxlcomponent-media");
 }
 
 //NVIDIA section tests.
-TEST(NVIDIASectionTests, IRValid)
+void NVIDIASectionTests_IRValid()
 {
 	cper_log_section_dual_ir_test("nvidia");
 }
-TEST(NVIDIASectionTests, BinaryEqual)
+void NVIDIASectionTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("nvidia");
 }
 
 //Unknown section tests.
-TEST(UnknownSectionTests, IRValid)
+void UnknownSectionTests_IRValid()
 {
 	cper_log_section_dual_ir_test("unknown");
 }
-TEST(UnknownSectionTests, BinaryEqual)
+void UnknownSectionTests_BinaryEqual()
 {
 	cper_log_section_dual_binary_test("unknown");
 }
 
 //Entrypoint for the testing program.
-int main(int argc, char **argv)
+int main()
 {
 	if (GEN_EXAMPLES) {
 		cper_create_examples("arm");
@@ -617,6 +628,46 @@
 		cper_create_examples("nvidia");
 		cper_create_examples("unknown");
 	}
-	testing::InitGoogleTest(&argc, argv);
-	return RUN_ALL_TESTS();
+	test_base64_encode_good();
+	test_base64_decode_good();
+	GenericProcessorTests_IRValid();
+	GenericProcessorTests_BinaryEqual();
+	IA32x64Tests_IRValid();
+	IA32x64Tests_BinaryEqual();
+	ArmTests_IRValid();
+	ArmTests_BinaryEqual();
+	MemoryTests_IRValid();
+	MemoryTests_BinaryEqual();
+	Memory2Tests_IRValid();
+	Memory2Tests_BinaryEqual();
+	PCIeTests_IRValid();
+	PCIeTests_BinaryEqual();
+	FirmwareTests_IRValid();
+	FirmwareTests_BinaryEqual();
+	PCIBusTests_IRValid();
+	PCIBusTests_BinaryEqual();
+	PCIDevTests_IRValid();
+	PCIDevTests_BinaryEqual();
+	DMArGenericTests_IRValid();
+	DMArGenericTests_BinaryEqual();
+	DMArVtdTests_IRValid();
+	DMArVtdTests_BinaryEqual();
+	DMArIOMMUTests_IRValid();
+	DMArIOMMUTests_BinaryEqual();
+	CCIXPERTests_IRValid();
+	CCIXPERTests_BinaryEqual();
+	CXLProtocolTests_IRValid();
+	CXLProtocolTests_BinaryEqual();
+	CXLComponentTests_IRValid();
+	CXLComponentTests_BinaryEqual();
+	NVIDIASectionTests_IRValid();
+	NVIDIASectionTests_BinaryEqual();
+	UnknownSectionTests_IRValid();
+	UnknownSectionTests_BinaryEqual();
+	CompileTimeAssertions_TwoWayConversion();
+	CompileTimeAssertions_ShortcodeNoSpaces();
+
+	printf("\n\nTest completed successfully.\n");
+
+	return 0;
 }
diff --git a/tests/meson.build b/tests/meson.build
index 0123dc2..8101587 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,37 +1,15 @@
-cmake = import('cmake')
-
-gtest = dependency('gtest', disabler: true, required: false)
-gmock = dependency('gmock', disabler: true, required: false)
-if not gtest.found() or not gmock.found()
-    gtest_proj = import('cmake').subproject('googletest', required: false)
-    if gtest_proj.found()
-        gtest = declare_dependency(
-            dependencies: [
-                dependency('threads'),
-                gtest_proj.dependency('gtest'),
-            ],
-        )
-        gmock = gtest_proj.dependency('gmock')
-    else
-        assert(
-            not get_option('tests').allowed(),
-            'Googletest is required if tests are enabled',
-        )
-    endif
-endif
-
 jsonc_daccord = dependency(
     'jsoncdac',
     default_options: ['default_library=static'],
 )
 
-test_sources = ['test-utils.c', 'base64_test.cpp']
+test_sources = files('base64_test.c', 'test-utils.c')
 
 test_include_dirs = ['.', '../include']
 
 cper_tests = executable(
     'cper-tests',
-    'ir-tests.cpp',
+    'ir-tests.c',
     test_sources,
     implicit_include_directories: false,
     include_directories: include_directories(test_include_dirs),
@@ -40,17 +18,15 @@
         jsonc_daccord,
         libcper_parse_dep,
         libcper_generate_dep,
-        gtest,
-        gmock,
     ],
 )
-test('test-cper-tests', cper_tests, protocol: 'gtest')
+test('test-cper-tests', cper_tests)
 
-cxx = meson.get_compiler('cpp')
+cc = meson.get_compiler('c')
 
 # Fuzzing only works on linux at this moment.  osx clang doesn't have leak detector
 is_darwin = host_machine.system().startswith('darwin')
-if (cxx.get_id() == 'clang') and get_option('fuzz').allowed() and not is_darwin
+if (cc.get_id() == 'clang') and get_option('fuzz').allowed() and not is_darwin
     sanitize = ['fuzzer']
     fuzz_args = [
         '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION',
@@ -63,7 +39,6 @@
             [fuzzer_test + '.c'] + libcper_parse_sources + edk_sources + 'test-utils.c' + libcper_generate_sources,
             implicit_include_directories: false,
             include_directories: include_directories(test_include_dirs),
-            cpp_args: fuzz_args,
             c_args: fuzz_args,
             link_args: fuzz_args,
             dependencies: [json_c_dep, jsonc_daccord],