aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.cpp
diff options
context:
space:
mode:
authorDaniel Neus <[email protected]>2016-07-19 15:37:27 +0200
committerDaniel Neus <[email protected]>2016-07-20 14:12:48 +0200
commitbc02dc731d1a02780e792b63c6c0a75b9e9b5ff4 (patch)
treeaea43904453535e438538918f3a42c6d1425dabd /src/tests/tests.cpp
parent308c7d5eda678566edd26e9ab20edbe772f46363 (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.cpp17
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)