aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/catchy/test_stl_util.cpp
blob: f7c2c999004ae4797c7f841501fce0bf2d9dbe89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// (C) 2015 Simon Warta (Kullo GmbH)
// Botan is released under the Simplified BSD License (see license.txt)

#include "catchy_tests.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_THAT(to_string(empty), Equals(""));
   CHECK_THAT(to_string(one),   Equals("^"));
   CHECK_THAT(to_string(some),  Equals("Hello"));
   CHECK_THAT(to_string(utf8),  Equals("ö"));
   }