diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/suites/api/test_array.c | 6 | ||||
-rw-r--r-- | test/suites/api/test_equal.c | 18 | ||||
-rw-r--r-- | test/suites/api/test_object.c | 2 |
3 files changed, 18 insertions, 8 deletions
diff --git a/test/suites/api/test_array.c b/test/suites/api/test_array.c index 9991fa0..a1a0934 100644 --- a/test/suites/api/test_array.c +++ b/test/suites/api/test_array.c @@ -186,7 +186,7 @@ static void test_insert(void) for(i = 0; i < 20; i++) { if(json_array_insert(array, 0, seven)) - fail("unable to insert value at the begining of an array"); + fail("unable to insert value at the beginning of an array"); } for(i = 0; i < 20; i++) { @@ -479,9 +479,9 @@ static void test_bad_args(void) if(!json_array_extend(num, arr)) fail("json_array_extend did not return error for first argument non-array"); if(!json_array_extend(arr, NULL)) - fail("json_array_extend did not return error for second arguemnt non-array"); + fail("json_array_extend did not return error for second argument non-array"); if(!json_array_extend(arr, num)) - fail("json_array_extend did not return error for second arguemnt non-array"); + fail("json_array_extend did not return error for second argument non-array"); if(num->refcount != 1) fail("unexpected reference count on num"); diff --git a/test/suites/api/test_equal.c b/test/suites/api/test_equal.c index 339bab6..ed1023f 100644 --- a/test/suites/api/test_equal.c +++ b/test/suites/api/test_equal.c @@ -159,7 +159,7 @@ static void test_equal_object() static void test_equal_complex() { - json_t *value1, *value2; + json_t *value1, *value2, *value3; const char *complex_json = "{" @@ -176,15 +176,25 @@ static void test_equal_complex() value1 = json_loads(complex_json, 0, NULL); value2 = json_loads(complex_json, 0, NULL); + value3 = json_loads(complex_json, 0, NULL); if(!value1 || !value2) fail("unable to parse JSON"); if(!json_equal(value1, value2)) - fail("json_equal fails for two inequal strings"); + fail("json_equal fails for two equal objects"); + + json_array_set_new(json_object_get(json_object_get(value2, "object"), + "array-in-object"), 1, json_false()); + if(json_equal(value1, value2)) + fail("json_equal fails for two inequal objects"); + + json_object_set_new(json_object_get(json_object_get(value3, "object"), + "object-in-object"), "foo", json_string("baz")); + if(json_equal(value1, value3)) + fail("json_equal fails for two inequal objects"); json_decref(value1); json_decref(value2); - - /* TODO: There's no negative test case here */ + json_decref(value3); } static void run_tests() diff --git a/test/suites/api/test_object.c b/test/suites/api/test_object.c index 521ca81..5c8813d 100644 --- a/test/suites/api/test_object.c +++ b/test/suites/api/test_object.c @@ -59,7 +59,7 @@ static void test_update() /* update an empty object with an empty object */ if(json_object_update(object, other)) - fail("unable to update an emtpy object with an empty object"); + fail("unable to update an empty object with an empty object"); if(json_object_size(object) != 0) fail("invalid size after update"); |