Add test suite, fix a mountain of small errors.
diff --git a/tests/test-utils.cpp b/tests/test-utils.cpp
new file mode 100644
index 0000000..0d4cabf
--- /dev/null
+++ b/tests/test-utils.cpp
@@ -0,0 +1,27 @@
+/**
+ * Defines utility functions for testing CPER-JSON IR output from the cper-parse library.
+ * 
+ * Author: Lawrence.Tang@arm.com
+ **/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "test-utils.hpp"
+extern "C" {
+#include "../edk/BaseTypes.h"
+#include "../generator/cper-generate.h"
+}
+
+//Returns a ready-for-use memory stream containing a CPER record with the given sections inside.
+FILE* generate_record_memstream(const char** types, UINT16 num_types, char** buf, size_t* buf_size)
+{
+    //Open a memory stream.
+    FILE* stream = open_memstream(buf, buf_size);
+
+    //Generate a section to the stream, close & return.
+    generate_cper_record((char**)types, num_types, stream);
+    fclose(stream);
+
+    //Return fmemopen() buffer for reading.
+    return fmemopen(*buf, *buf_size, "r");
+}
\ No newline at end of file