aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/catchy
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-07-09 09:35:18 +0200
committerSimon Warta <[email protected]>2015-07-15 13:51:20 +0200
commit356ec5a86978143991db5b667ccc5ea815a73d00 (patch)
tree079b19221cdfdedfd511bd505b357b75e50ab6b0 /src/tests/catchy
parent75a769a8487eecdb05acd495c4625245876a01b3 (diff)
Add test: stl_util; Add empty test: utils
Diffstat (limited to 'src/tests/catchy')
-rw-r--r--src/tests/catchy/test_stl_util.cpp21
-rw-r--r--src/tests/catchy/test_utils.cpp7
2 files changed, 28 insertions, 0 deletions
diff --git a/src/tests/catchy/test_stl_util.cpp b/src/tests/catchy/test_stl_util.cpp
new file mode 100644
index 000000000..a0b38b045
--- /dev/null
+++ b/src/tests/catchy/test_stl_util.cpp
@@ -0,0 +1,21 @@
+// (C) 2015 Simon Warta (Kullo GmbH)
+// Botan is released under the Simplified BSD License (see license.txt)
+
+#include "catch.hpp"
+#include <botan/types.h>
+#include <botan/internal/stl_util.h>
+
+TEST_CASE("secure vector to string", "[STL_Util]")
+ {
+ using namespace Botan;
+ auto empty = secure_vector<byte>{ };
+ auto one = secure_vector<byte>{ 94 };
+ auto some = secure_vector<byte>{ 0x48, 0x65, 0x6c, 0x6c, 0x6f };
+ // echo -n "ö" | hexdump -C
+ auto utf8 = secure_vector<byte>{ 0xc3, 0xb6 };
+
+ CHECK(( to_string(empty) == "" ));
+ CHECK(( to_string(one) == "^" ));
+ CHECK(( to_string(some) == "Hello" ));
+ CHECK(( to_string(utf8) == "ö" ));
+ }
diff --git a/src/tests/catchy/test_utils.cpp b/src/tests/catchy/test_utils.cpp
new file mode 100644
index 000000000..17c35a678
--- /dev/null
+++ b/src/tests/catchy/test_utils.cpp
@@ -0,0 +1,7 @@
+// (C) 2015 Simon Warta (Kullo GmbH)
+// Botan is released under the Simplified BSD License (see license.txt)
+
+#include "catch.hpp"
+
+using namespace Botan;
+