summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/tar_gnu.c12
-rw-r--r--tests/tar_pax.c12
-rw-r--r--tests/tar_ustar.c12
-rw-r--r--tests/test.h1
4 files changed, 22 insertions, 15 deletions
diff --git a/tests/tar_gnu.c b/tests/tar_gnu.c
index 9d0b010..9746cb0 100644
--- a/tests/tar_gnu.c
+++ b/tests/tar_gnu.c
@@ -95,11 +95,13 @@ int main(void)
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
TEST_EQUAL_UI(hdr.sb.st_gid, 01750);
TEST_EQUAL_UI(hdr.sb.st_size, 5);
-#if SIZEOF_TIME_T < 8
- TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
-#else
- TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
-#endif
+
+ if (sizeof(time_t) * CHAR_BIT < 64) {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
+ } else {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
+ }
+
TEST_EQUAL_UI(hdr.mtime, 8589934592L);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
diff --git a/tests/tar_pax.c b/tests/tar_pax.c
index f2e4c5f..86dc186 100644
--- a/tests/tar_pax.c
+++ b/tests/tar_pax.c
@@ -78,11 +78,13 @@ int main(void)
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
TEST_EQUAL_UI(hdr.sb.st_gid, 01750);
TEST_EQUAL_UI(hdr.sb.st_size, 5);
-#if SIZEOF_TIME_T < 8
- TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
-#else
- TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
-#endif
+
+ if (sizeof(time_t) * CHAR_BIT < 64) {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
+ } else {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
+ }
+
TEST_EQUAL_UI(hdr.mtime, 8589934592L);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
diff --git a/tests/tar_ustar.c b/tests/tar_ustar.c
index 8d4c828..b794e30 100644
--- a/tests/tar_ustar.c
+++ b/tests/tar_ustar.c
@@ -110,11 +110,13 @@ int main(void)
TEST_EQUAL_UI(hdr.sb.st_uid, 01750);
TEST_EQUAL_UI(hdr.sb.st_gid, 01750);
TEST_EQUAL_UI(hdr.sb.st_size, 5);
-#if SIZEOF_TIME_T < 8
- TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
-#else
- TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
-#endif
+
+ if (sizeof(time_t) * CHAR_BIT < 64) {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, INT32_MAX);
+ } else {
+ TEST_EQUAL_UI(hdr.sb.st_mtime, 8589934592L);
+ }
+
TEST_EQUAL_UI(hdr.mtime, 8589934592L);
TEST_STR_EQUAL(hdr.name, "input.txt");
TEST_ASSERT(!hdr.unknown_record);
diff --git a/tests/test.h b/tests/test.h
index 4e05dac..7d38fd0 100644
--- a/tests/test.h
+++ b/tests/test.h
@@ -9,6 +9,7 @@
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include <stdio.h>
#include <errno.h>