test-asn1: Fix skipping of >2038 tests on i386

The two constants overflow time_t on i386 (they also produced a compiler
warning without type suffix) so the comparison with TIME_32_BIT_SIGNED_MAX
did not work as intended.

Fixes #477.
This commit is contained in:
Tobias Brunner
2014-01-06 18:23:40 +01:00
parent d62a6ec3f9
commit 94e10f15e5
+35 -35
View File
@@ -454,25 +454,25 @@ START_TEST(test_asn1_to_time)
} testdata_t;
testdata_t test[] = {
{ 352980, 0x18, "197001050203Z" },
{ 352984, 0x18, "19700105020304Z" },
{ 352980, 0x17, "7001050203Z" },
{ 347580, 0x17, "7001050203+0130" },
{ 358380, 0x17, "7001050203-0130" },
{ 352984, 0x17, "700105020304Z" },
{ 347584, 0x17, "700105020304+0130" },
{ 358384, 0x17, "700105020304-0130" },
{ 0, 0x17, "700105020304+01" },
{ 0, 0x17, "700105020304-01" },
{ 0, 0x17, "700105020304" },
{ 0, 0x17, "70010502Z" },
{ 0, 0x17, "7001050203xxZ" },
{ 0, 0x17, "7000050203Z" },
{ 0, 0x17, "7013050203Z" },
{ 5097600, 0x17, "7003010000Z" },
{ 68256000, 0x17, "7203010000Z" },
{ 951868800, 0x17, "0003010000Z" },
{ 4107542400, 0x18, "210003010000Z" }
{ 352980, 0x18, "197001050203Z" },
{ 352984, 0x18, "19700105020304Z" },
{ 352980, 0x17, "7001050203Z" },
{ 347580, 0x17, "7001050203+0130" },
{ 358380, 0x17, "7001050203-0130" },
{ 352984, 0x17, "700105020304Z" },
{ 347584, 0x17, "700105020304+0130" },
{ 358384, 0x17, "700105020304-0130" },
{ 0, 0x17, "700105020304+01" },
{ 0, 0x17, "700105020304-01" },
{ 0, 0x17, "700105020304" },
{ 0, 0x17, "70010502Z" },
{ 0, 0x17, "7001050203xxZ" },
{ 0, 0x17, "7000050203Z" },
{ 0, 0x17, "7013050203Z" },
{ 5097600, 0x17, "7003010000Z" },
{ 68256000, 0x17, "7203010000Z" },
{ 951868800, 0x17, "0003010000Z" },
{ 4107542400UL, 0x18, "210003010000Z" }
};
int i;
@@ -480,7 +480,7 @@ START_TEST(test_asn1_to_time)
for (i = 0; i < countof(test); i++)
{
if (test[i].time > TIME_32_BIT_SIGNED_MAX && sizeof(time_t) == 4)
if (sizeof(time_t) == 4 && test[i].time < 0)
{
continue;
}
@@ -503,18 +503,18 @@ START_TEST(test_asn1_from_time)
} testdata_t;
testdata_t test[] = {
{ 352984, 0x18, chunk_from_chars(
0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
{ 352984, 0x17, chunk_from_chars(
0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
{ 1078099200, 0x17, chunk_from_chars(
0x17, 0x0d, 0x30, 0x34, 0x30, 0x33, 0x30, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) },
{ 4107542400, 0x18, chunk_from_chars(
0x18, 0x0f, 0x32, 0x31, 0x30, 0x30, 0x30, 0x33, 0x30, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) }
{ 352984, 0x18, chunk_from_chars(
0x18, 0x0f, 0x31, 0x39, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
{ 352984, 0x17, chunk_from_chars(
0x17, 0x0d, 0x37, 0x30, 0x30, 0x31, 0x30, 0x35,
0x30, 0x32, 0x30, 0x33, 0x30, 0x34, 0x5a) },
{ 1078099200, 0x17, chunk_from_chars(
0x17, 0x0d, 0x30, 0x34, 0x30, 0x33, 0x30, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) },
{ 4107542400UL, 0x18, chunk_from_chars(
0x18, 0x0f, 0x32, 0x31, 0x30, 0x30, 0x30, 0x33, 0x30, 0x31,
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5a) }
};
int i;
@@ -522,10 +522,10 @@ START_TEST(test_asn1_from_time)
for (i = 0; i < countof(test); i++)
{
if (test[i].time > TIME_32_BIT_SIGNED_MAX && sizeof(time_t) == 4)
{
if (sizeof(time_t) == 4 && test[i].time < 0)
{
continue;
}
}
chunk = asn1_from_time(&test[i].time, test[i].type);
ck_assert(chunk_equals(chunk, test[i].chunk));
free(chunk.ptr);