Remove validation bits

Discard invalid properties from json decode. JSON output should only
contain valid properties. This saves time in preventing post
processing of output for valid fields.

Ensure round trip validity with validation bits removed and required
properties populated.

Fix bugs in json decode.

Overhaul unit tests to use valijson. Add tests with static examples
to validate against schema. Use and nlohmann for better schema
validation over intrinsic libcper validation.

Example json output before:
{
  "ValidationBits": {
    "LevelValid": false,
    "CorrectedValid": true
  },
  "Level": 1,
  "Corrected": true
}

After:
{
  "Corrected": true
}

Change-Id: I188bdc2827a57d938c22a431238fadfcdc939ab8
Signed-off-by: Aushim Nagarkatti <anagarkatti@nvidia.com>
diff --git a/tests/meson.build b/tests/meson.build
index 68eb1f3..d9e9d96 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,3 +1,5 @@
+cmake = import('cmake')
+
 gtest = dependency('gtest', main: true, disabler: true, required: false)
 gmock = dependency('gmock', disabler: true, required: false)
 if not gtest.found() or not gmock.found()
@@ -19,6 +21,23 @@
     endif
 endif
 
+nlohmann_json_dep = dependency(
+    'nlohmann_json',
+    required: false,
+    version: '>=3.11.2',
+    include_type: 'system',
+)
+if not nlohmann_json_dep.found()
+    nlohmann_proj = subproject('nlohmann_json', required: true)
+    nlohmann_json_dep = nlohmann_proj.get_variable('nlohmann_json_dep')
+endif
+
+valijson_dep = dependency('valijson', required: false)
+if not valijson_dep.found()
+    valijson_proj = cmake.subproject('valijson')
+    valijson_dep = valijson_proj.get_variable('valijson_dep')
+endif
+
 sources = ['ir-tests.cpp', 'test-utils.cpp', 'base64_test.cpp']
 
 test_include_dirs = ['.', '../include']
@@ -35,6 +54,8 @@
         json_c_dep,
         gtest,
         gmock,
+        nlohmann_json_dep,
+        valijson_dep
     ],
 )
 test('test-cper-tests', cper_tests)