aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tests/catchy/test_x509.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tests/catchy/test_x509.cpp b/src/tests/catchy/test_x509.cpp
index ad4aa1b1b..448e06847 100644
--- a/src/tests/catchy/test_x509.cpp
+++ b/src/tests/catchy/test_x509.cpp
@@ -8,6 +8,7 @@
#include <botan/asn1_time.h>
using namespace Botan;
+using namespace Catch;
TEST_CASE("human readable time", "[X509]")
{
@@ -24,6 +25,22 @@ TEST_CASE("human readable time", "[X509]")
CHECK_THAT(time3.readable_string(), Equals("2004/06/14 23:34:30 UTC"));
}
+TEST_CASE("Implicit copy constructor", "[X509]")
+ {
+ auto time_orig = X509_Time("0802010000Z", ASN1_Tag::UTC_TIME);
+ auto time_copy = time_orig;
+
+ // Check that implicit copy and assignment work:
+ // time_copy and time_orig must have the same data but
+ // must sit at different places in memory
+ CHECK((time_orig == time_copy));
+
+ auto address1 = reinterpret_cast<uintptr_t>(&time_orig);
+ auto address2 = reinterpret_cast<uintptr_t>(&time_copy);
+
+ CHECK_THAT(address1, Not(Equals(address2)));
+ }
+
TEST_CASE("no time", "[X509]")
{
auto time = X509_Time();