aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_utils.cpp
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2017-03-21 22:10:23 +0100
committerDaniel Neus <[email protected]>2017-03-21 22:10:23 +0100
commit08a79d79f6df547346641b55b82426832c558cba (patch)
treec9549ea3040d2cd6d0daa7450b5c38d2d8fcedd3 /src/tests/test_utils.cpp
parentf8a1e6b91908ee572f979a1de3b96b1f477ed128 (diff)
Fix #917: calendar_point::to_std_timepoint() does not support years after 2037
Only throw on systems where 32 bit std::time_t is used.
Diffstat (limited to 'src/tests/test_utils.cpp')
-rw-r--r--src/tests/test_utils.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp
index ae9cf72dd..ce301918d 100644
--- a/src/tests/test_utils.cpp
+++ b/src/tests/test_utils.cpp
@@ -7,6 +7,7 @@
#include "tests.h"
#include <functional>
+#include <ctime>
#include <botan/loadstor.h>
#include <botan/calendar.h>
#include <botan/internal/rounding.h>
@@ -201,7 +202,7 @@ class Date_Format_Tests : public Text_Based_Test
const std::vector<uint32_t> d = parse_date(get_req_str(vars, "Date"));
- if(type == "valid" || type == "valid.not_std")
+ if(type == "valid" || type == "valid.not_std" || type == "valid.64_bit_time_t")
{
Botan::calendar_point c(d[0], d[1], d[2], d[3], d[4], d[5]);
result.test_is_eq("year", c.year, d[0]);
@@ -211,7 +212,7 @@ class Date_Format_Tests : public Text_Based_Test
result.test_is_eq("minute", c.minutes, d[4]);
result.test_is_eq("second", c.seconds, d[5]);
- if(type == "valid.not_std")
+ if(type == "valid.not_std" || type == "valid.64_bit_time_t" && c.year > 2037 && sizeof(std::time_t) == 4)
{
result.test_throws("valid but out of std::timepoint range", [c]() { c.to_std_timepoint(); });
}