Move ApplyPatch tests from test_utils.c to json.

This commit is contained in:
Max Bruckner
2017-04-13 20:15:25 +02:00
parent 8fd46d51b1
commit 49ebc85e7a
3 changed files with 101 additions and 15 deletions

View File

@@ -151,12 +151,29 @@ static void cjson_utils_should_pass_json_patch_test_spec_tests(void)
TEST_ASSERT_FALSE_MESSAGE(failed, "Some tests failed.");
}
static void cjson_utils_should_pass_json_patch_test_cjson_utils_tests(void)
{
cJSON *tests = parse_test_file("json-patch-tests/cjson-utils-tests.json");
cJSON *test = NULL;
cJSON_bool failed = false;
cJSON_ArrayForEach(test, tests)
{
failed |= !test_apply_patch(test);
}
cJSON_Delete(tests);
TEST_ASSERT_FALSE_MESSAGE(failed, "Some tests failed.");
}
int main(void)
{
UNITY_BEGIN();
RUN_TEST(cjson_utils_should_pass_json_patch_test_tests);
RUN_TEST(cjson_utils_should_pass_json_patch_test_spec_tests);
RUN_TEST(cjson_utils_should_pass_json_patch_test_cjson_utils_tests);
return UNITY_END();
}