Skip to content

Commit

Permalink
Add simple.c test to tests/tests.c
Browse files Browse the repository at this point in the history
  • Loading branch information
themobiusproject committed Nov 14, 2021
1 parent 9f7e9de commit 0560339
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,24 @@ int test_object_key(void) {
return 0;
}

int test_simple(void) {
check(parse("{\"user\": \"johndoe\", \"admin\": false, \"uid\": 1000,\"groups\": [\"users\", \"wheel\", \"audio\", \"video\"]}", 13, 13,
JSMN_OBJECT, 0, 95, 4,
JSMN_STRING, "user", 1,
JSMN_STRING, "johndoe", 0,
JSMN_STRING, "admin", 1,
JSMN_PRIMITIVE, "false",
JSMN_STRING, "uid", 1,
JSMN_PRIMITIVE, "1000",
JSMN_STRING, "groups", 1,
JSMN_ARRAY, 58, 94, 4,
JSMN_STRING, "users", 0,
JSMN_STRING, "wheel", 0,
JSMN_STRING, "audio", 0,
JSMN_STRING, "video", 0));
return 0;
}

int main(void) {
test(test_empty, "test for a empty JSON objects/arrays");
test(test_object, "test for a JSON objects");
Expand All @@ -1715,6 +1733,7 @@ int main(void) {
test(test_nonstrict, "test for non-strict mode");
test(test_unmatched_brackets, "test for unmatched brackets");
test(test_object_key, "test for key type");
test(test_simple, "test for jsmn string from simple.c");

test(test_jsmn_test_suite_i_, "test jsmn test suite implementation");
test(test_jsmn_test_suite_n_, "test jsmn test suite should fail");
Expand Down

0 comments on commit 0560339

Please sign in to comment.