Commit 3f28eafe by Calvin Buckley

stdint constants in test suite

Passes w/ gcc 11 on Fedora x64.

Protip: So you don;t have to suffer,

```
perl -pe 's/(-?(?:0x)?[A-Fa-f0-9]+)([Uu])?[Ll][Ll]/\U$2INT64_C(\E$1)/mg'
```
parent 52505ab5
...@@ -14,7 +14,7 @@ void test_core_encoding__decode(void) ...@@ -14,7 +14,7 @@ void test_core_encoding__decode(void)
cl_assert(size == 4); cl_assert(size == 4);
buf = (unsigned char *)"\xaa\xaa\xfe\xdc\xbaXY"; buf = (unsigned char *)"\xaa\xaa\xfe\xdc\xbaXY";
cl_assert(git_decode_varint(buf, &size) == 1489279344088ULL); cl_assert(git_decode_varint(buf, &size) == UINT64_C(1489279344088));
cl_assert(size == 6); cl_assert(size == 6);
buf = (unsigned char *)"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xfe\xdc\xbaXY"; buf = (unsigned char *)"\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xfe\xdc\xbaXY";
...@@ -35,8 +35,8 @@ void test_core_encoding__encode(void) ...@@ -35,8 +35,8 @@ void test_core_encoding__encode(void)
cl_assert(git_encode_varint(buf, 100, 267869656) == 4); cl_assert(git_encode_varint(buf, 100, 267869656) == 4);
cl_assert(!memcmp(buf, "\xfe\xdc\xbaX", 4)); cl_assert(!memcmp(buf, "\xfe\xdc\xbaX", 4));
cl_assert(git_encode_varint(buf, 100, 1489279344088ULL) == 6); cl_assert(git_encode_varint(buf, 100, UINT64_C(1489279344088)) == 6);
cl_assert(!memcmp(buf, "\xaa\xaa\xfe\xdc\xbaX", 6)); cl_assert(!memcmp(buf, "\xaa\xaa\xfe\xdc\xbaX", 6));
cl_assert(git_encode_varint(buf, 1, 1489279344088ULL) == -1); cl_assert(git_encode_varint(buf, 1, UINT64_C(1489279344088)) == -1);
} }
...@@ -32,7 +32,7 @@ void test_core_strtol__int32(void) ...@@ -32,7 +32,7 @@ void test_core_strtol__int32(void)
assert_l32_parses(" +123 ", 123, 10); assert_l32_parses(" +123 ", 123, 10);
assert_l32_parses(" -123 ", -123, 10); assert_l32_parses(" -123 ", -123, 10);
assert_l32_parses(" +2147483647 ", 2147483647, 10); assert_l32_parses(" +2147483647 ", 2147483647, 10);
assert_l32_parses(" -2147483648 ", -2147483648LL, 10); assert_l32_parses(" -2147483648 ", INT64_C(-2147483648), 10);
assert_l32_parses("A", 10, 16); assert_l32_parses("A", 10, 16);
assert_l32_parses("1x1", 1, 10); assert_l32_parses("1x1", 1, 10);
...@@ -49,9 +49,9 @@ void test_core_strtol__int64(void) ...@@ -49,9 +49,9 @@ void test_core_strtol__int64(void)
assert_l64_parses(" +123 ", 123, 10); assert_l64_parses(" +123 ", 123, 10);
assert_l64_parses(" -123 ", -123, 10); assert_l64_parses(" -123 ", -123, 10);
assert_l64_parses(" +2147483647 ", 2147483647, 10); assert_l64_parses(" +2147483647 ", 2147483647, 10);
assert_l64_parses(" -2147483648 ", -2147483648LL, 10); assert_l64_parses(" -2147483648 ", INT64_C(-2147483648), 10);
assert_l64_parses(" 2147483657 ", 2147483657LL, 10); assert_l64_parses(" 2147483657 ", INT64_C(2147483657), 10);
assert_l64_parses(" -2147483657 ", -2147483657LL, 10); assert_l64_parses(" -2147483657 ", INT64_C(-2147483657), 10);
assert_l64_parses(" 9223372036854775807 ", INT64_MAX, 10); assert_l64_parses(" 9223372036854775807 ", INT64_MAX, 10);
assert_l64_parses(" -9223372036854775808 ", INT64_MIN, 10); assert_l64_parses(" -9223372036854775808 ", INT64_MIN, 10);
assert_l64_parses(" 0x7fffffffffffffff ", INT64_MAX, 16); assert_l64_parses(" 0x7fffffffffffffff ", INT64_MAX, 16);
......
...@@ -23,14 +23,14 @@ void test_graph_commit_graph__parse(void) ...@@ -23,14 +23,14 @@ void test_graph_commit_graph__parse(void)
cl_git_pass(git_oid_fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47")); cl_git_pass(git_oid_fromstr(&id, "418382dff1ffb8bdfba833f4d8bbcde58b1e7f47"));
cl_assert_equal_oid(&e.tree_oid, &id); cl_assert_equal_oid(&e.tree_oid, &id);
cl_assert_equal_i(e.generation, 1); cl_assert_equal_i(e.generation, 1);
cl_assert_equal_i(e.commit_time, 1273610423ull); cl_assert_equal_i(e.commit_time, UINT64_C(1273610423));
cl_assert_equal_i(e.parent_count, 0); cl_assert_equal_i(e.parent_count, 0);
cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644")); cl_git_pass(git_oid_fromstr(&id, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644"));
cl_git_pass(git_commit_graph_entry_find(&e, cgraph, &id, GIT_OID_HEXSZ)); cl_git_pass(git_commit_graph_entry_find(&e, cgraph, &id, GIT_OID_HEXSZ));
cl_assert_equal_oid(&e.sha1, &id); cl_assert_equal_oid(&e.sha1, &id);
cl_assert_equal_i(e.generation, 5); cl_assert_equal_i(e.generation, 5);
cl_assert_equal_i(e.commit_time, 1274813907ull); cl_assert_equal_i(e.commit_time, UINT64_C(1274813907));
cl_assert_equal_i(e.parent_count, 2); cl_assert_equal_i(e.parent_count, 2);
cl_git_pass(git_oid_fromstr(&id, "9fd738e8f7967c078dceed8190330fc8648ee56a")); cl_git_pass(git_oid_fromstr(&id, "9fd738e8f7967c078dceed8190330fc8648ee56a"));
...@@ -66,7 +66,7 @@ void test_graph_commit_graph__parse_octopus_merge(void) ...@@ -66,7 +66,7 @@ void test_graph_commit_graph__parse_octopus_merge(void)
cl_git_pass(git_oid_fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c")); cl_git_pass(git_oid_fromstr(&id, "348f16ffaeb73f319a75cec5b16a0a47d2d5e27c"));
cl_assert_equal_oid(&e.tree_oid, &id); cl_assert_equal_oid(&e.tree_oid, &id);
cl_assert_equal_i(e.generation, 7); cl_assert_equal_i(e.generation, 7);
cl_assert_equal_i(e.commit_time, 1447083009ull); cl_assert_equal_i(e.commit_time, INT64_C(1447083009));
cl_assert_equal_i(e.parent_count, 3); cl_assert_equal_i(e.parent_count, 3);
cl_git_pass(git_oid_fromstr(&id, "ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6")); cl_git_pass(git_oid_fromstr(&id, "ad2ace9e15f66b3d1138922e6ffdc3ea3f967fa6"));
......
...@@ -530,7 +530,7 @@ void test_revwalk_basic__big_timestamp(void) ...@@ -530,7 +530,7 @@ void test_revwalk_basic__big_timestamp(void)
cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJECT_COMMIT)); cl_git_pass(git_reference_peel((git_object **) &tip, head, GIT_OBJECT_COMMIT));
/* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */ /* Commit with a far-ahead timestamp, we should be able to parse it in the revwalk */
cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", 2399662595ll, 0)); cl_git_pass(git_signature_new(&sig, "Joe", "joe@example.com", INT64_C(2399662595), 0));
cl_git_pass(git_commit_tree(&tree, tip)); cl_git_pass(git_commit_tree(&tree, tip));
cl_git_pass(git_commit_create(&id, _repo, "HEAD", sig, sig, NULL, "some message", tree, 1, cl_git_pass(git_commit_create(&id, _repo, "HEAD", sig, sig, NULL, "some message", tree, 1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment