diff options
author | Simon Warta <[email protected]> | 2015-08-08 18:05:19 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2015-08-11 10:50:14 +0200 |
commit | b2d31e4bc77c9bb707bdf5ad3f76882a07134721 (patch) | |
tree | 99d8d8ba35b319595d1225be8c0913cb0ea51669 /src/tests/catchy | |
parent | a35294066c8d24f685bc84a93f3bf1e2931e6db3 (diff) |
Test implicit X509_Time copy constructor and assignment
Diffstat (limited to 'src/tests/catchy')
-rw-r--r-- | src/tests/catchy/test_x509.cpp | 17 |
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(); |