mirror of
https://github.com/json-c/json-c.git
synced 2026-04-04 12:59:07 +08:00
Cast to int64_t instead of long in test_int_add to fix the test on 32-bit platforms.
This commit is contained in:
@@ -13,13 +13,13 @@ int main(int argc, char **argv)
|
|||||||
tmp = json_object_new_int(INT32_MAX);
|
tmp = json_object_new_int(INT32_MAX);
|
||||||
json_object_int_inc(tmp, 100);
|
json_object_int_inc(tmp, 100);
|
||||||
assert(json_object_get_int(tmp) == INT32_MAX);
|
assert(json_object_get_int(tmp) == INT32_MAX);
|
||||||
assert(json_object_get_int64(tmp) == (long)INT32_MAX + 100L);
|
assert(json_object_get_int64(tmp) == (int64_t)INT32_MAX + 100L);
|
||||||
json_object_put(tmp);
|
json_object_put(tmp);
|
||||||
printf("INT ADD OVERFLOW PASSED\n");
|
printf("INT ADD OVERFLOW PASSED\n");
|
||||||
tmp = json_object_new_int(INT32_MIN);
|
tmp = json_object_new_int(INT32_MIN);
|
||||||
json_object_int_inc(tmp, -100);
|
json_object_int_inc(tmp, -100);
|
||||||
assert(json_object_get_int(tmp) == INT32_MIN);
|
assert(json_object_get_int(tmp) == INT32_MIN);
|
||||||
assert(json_object_get_int64(tmp) == (long)INT32_MIN - 100L);
|
assert(json_object_get_int64(tmp) == (int64_t)INT32_MIN - 100L);
|
||||||
json_object_put(tmp);
|
json_object_put(tmp);
|
||||||
printf("INT ADD UNDERFLOW PASSED\n");
|
printf("INT ADD UNDERFLOW PASSED\n");
|
||||||
tmp = json_object_new_int64(321321321);
|
tmp = json_object_new_int64(321321321);
|
||||||
|
|||||||
Reference in New Issue
Block a user