22Ensure (json, can_json_escape_strings)
24 const char *unescaped_string =
"\"'Abc\\\b\f\n\r\t\001Äöü'\"";
25 const char *escaped_string_dq =
"\\\"'Abc\\\\\\b\\f\\n\\r\\t\\u0001Äöü'\\\"";
26 const char *escaped_string_sq =
"\"\\'Abc\\\\\\b\\f\\n\\r\\t\\u0001Äöü\\'\"";
28 gchar *escaped_string = NULL;
30 assert_that (escaped_string, is_null);
33 assert_that (escaped_string, is_equal_to_string (escaped_string_dq));
34 g_free (escaped_string);
37 assert_that (escaped_string, is_equal_to_string (escaped_string_sq));
38 g_free (escaped_string);
99Ensure (json, gvm_json_obj_check_str_0_and_val_when_has)
104 json = cJSON_Parse (
"{ \"eg\": \"abc\" }");
105 assert_that (json, is_not_null);
107 assert_that (ret, is_equal_to_string (
"abc"));
207Ensure (json, gvm_json_obj_check_int_0_and_val_when_has)
212 json = cJSON_Parse (
"{ \"eg\": 33 }");
213 assert_that (json, is_not_null);
215 assert_that (ret, is_equal_to (33));
225 suite = create_test_suite ();
227 add_test_with_context (suite, json, can_json_escape_strings);
229 add_test_with_context (suite, json, gvm_json_obj_double_gets_value);
230 add_test_with_context (suite, json, gvm_json_obj_double_0_when_missing);
232 add_test_with_context (suite, json, gvm_json_obj_str_gets_value);
233 add_test_with_context (suite, json, gvm_json_obj_str_null_when_missing);
235 add_test_with_context (suite, json, gvm_json_obj_int_gets_value);
236 add_test_with_context (suite, json, gvm_json_obj_int_0_when_missing);
237 add_test_with_context (suite, json, gvm_json_obj_int_0_when_str);
239 add_test_with_context (suite, json, gvm_json_obj_check_int_0_when_has);
240 add_test_with_context (suite, json, gvm_json_obj_check_int_1_when_missing);
241 add_test_with_context (suite, json, gvm_json_obj_check_int_1_when_str);
242 add_test_with_context (suite, json,
243 gvm_json_obj_check_int_0_and_val_when_has);
245 add_test_with_context (suite, json, gvm_json_obj_check_str_0_when_has);
246 add_test_with_context (suite, json, gvm_json_obj_check_str_1_when_missing);
247 add_test_with_context (suite, json, gvm_json_obj_check_str_1_when_int);
248 add_test_with_context (suite, json,
249 gvm_json_obj_check_str_0_and_val_when_has);
252 ret = run_single_test (suite, argv[1], create_text_reporter ());
254 ret = run_test_suite (suite, create_text_reporter ());
256 destroy_test_suite (suite);