diff options
author | Daniel Neus <[email protected]> | 2016-07-19 15:37:27 +0200 |
---|---|---|
committer | Daniel Neus <[email protected]> | 2016-07-20 14:12:48 +0200 |
commit | bc02dc731d1a02780e792b63c6c0a75b9e9b5ff4 (patch) | |
tree | aea43904453535e438538918f3a42c6d1425dabd /src/tests/tests.cpp | |
parent | 308c7d5eda678566edd26e9ab20edbe772f46363 (diff) |
add OctetString unit tests
and add the possibility to compare OctetStrings with the botan test-framework
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index aae4174b9..578418ffb 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -190,6 +190,23 @@ bool Test::Result::test_eq(const std::string& what, size_t produced, size_t expe return test_is_eq(what, produced, expected); } +bool Test::Result::test_eq(const std::string& what, OctetString produced, OctetString expected) + { + std::ostringstream out; + out << m_who << " " << what; + + if(produced == expected) + { + out << " produced expected result " << produced.as_string(); + return test_success(out.str()); + } + else + { + out << " produced unexpected result " << produced.as_string() << " expected " << expected.as_string(); + return test_failure(out.str()); + } + } + bool Test::Result::test_lt(const std::string& what, size_t produced, size_t expected) { if(produced >= expected) |