aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_octetstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/test_octetstring.cpp')
-rw-r--r--src/tests/test_octetstring.cpp40
1 files changed, 19 insertions, 21 deletions
diff --git a/src/tests/test_octetstring.cpp b/src/tests/test_octetstring.cpp
index ff689518e..ff9e179ac 100644
--- a/src/tests/test_octetstring.cpp
+++ b/src/tests/test_octetstring.cpp
@@ -12,13 +12,11 @@ namespace Botan_Tests {
namespace {
-using Botan::OctetString;
-
Test::Result test_from_rng()
{
Test::Result result("OctetString");
- OctetString os(Test::rng(), 32);
+ Botan::OctetString os(Test::rng(), 32);
result.test_eq("length is 32 bytes", os.size(), 32);
return result;
@@ -28,7 +26,7 @@ Test::Result test_from_hex()
{
Test::Result result("OctetString");
- OctetString os("0123456789ABCDEF");
+ Botan::OctetString os("0123456789ABCDEF");
result.test_eq("length is 8 bytes", os.size(), 8);
return result;
@@ -39,7 +37,7 @@ Test::Result test_from_byte()
Test::Result result("OctetString");
auto rand_bytes = Test::rng().random_vec(8);
- OctetString os(rand_bytes.data(), rand_bytes.size());
+ Botan::OctetString os(rand_bytes.data(), rand_bytes.size());
result.test_eq("length is 8 bytes", os.size(), 8);
return result;
@@ -49,14 +47,14 @@ Test::Result test_odd_parity()
{
Test::Result result("OctetString");
- OctetString os("FFFFFFFFFFFFFFFF");
+ Botan::OctetString os("FFFFFFFFFFFFFFFF");
os.set_odd_parity();
- OctetString expected("FEFEFEFEFEFEFEFE");
+ Botan::OctetString expected("FEFEFEFEFEFEFEFE");
result.test_eq("odd parity set correctly", os, expected);
- OctetString os2("EFCBDA4FAA997F63");
+ Botan::OctetString os2("EFCBDA4FAA997F63");
os2.set_odd_parity();
- OctetString expected2("EFCBDA4FAB987F62");
+ Botan::OctetString expected2("EFCBDA4FAB987F62");
result.test_eq("odd parity set correctly", os2, expected2);
return result;
@@ -66,7 +64,7 @@ Test::Result test_as_string()
{
Test::Result result("OctetString");
- OctetString os("0123456789ABCDEF");
+ Botan::OctetString os("0123456789ABCDEF");
result.test_eq("OctetString::as_string() returns correct string", os.as_string(), "0123456789ABCDEF");
return result;
@@ -76,10 +74,10 @@ Test::Result test_xor()
{
Test::Result result("OctetString");
- OctetString os1("0000000000000000");
- OctetString os2("FFFFFFFFFFFFFFFF");
+ Botan::OctetString os1("0000000000000000");
+ Botan::OctetString os2("FFFFFFFFFFFFFFFF");
- OctetString xor_result = os1 ^ os2;
+ Botan::OctetString xor_result = os1 ^ os2;
result.test_eq("OctetString XOR operations works as expected", xor_result, os2);
xor_result = os1;
@@ -89,9 +87,9 @@ Test::Result test_xor()
xor_result = os2 ^ os2;
result.test_eq("OctetString XOR operations works as expected", xor_result, os1);
- OctetString os3("0123456789ABCDEF");
+ Botan::OctetString os3("0123456789ABCDEF");
xor_result = os3 ^ os2;
- OctetString expected("FEDCBA9876543210");
+ Botan::OctetString expected("FEDCBA9876543210");
result.test_eq("OctetString XOR operations works as expected", xor_result, expected);
return result;
@@ -101,8 +99,8 @@ Test::Result test_equality()
{
Test::Result result("OctetString");
- OctetString os1("0000000000000000");
- OctetString os2("FFFFFFFFFFFFFFFF");
+ Botan::OctetString os1("0000000000000000");
+ Botan::OctetString os2("FFFFFFFFFFFFFFFF");
result.confirm("OctetString equality operations works as expected", os1 == os1);
result.confirm("OctetString equality operations works as expected", os2 == os2);
@@ -115,11 +113,11 @@ Test::Result test_append()
{
Test::Result result("OctetString");
- OctetString os1("0000");
- OctetString os2("FFFF");
- OctetString expected("0000FFFF");
+ Botan::OctetString os1("0000");
+ Botan::OctetString os2("FFFF");
+ Botan::OctetString expected("0000FFFF");
- OctetString append_result = os1 + os2;
+ Botan::OctetString append_result = os1 + os2;
result.test_eq("OctetString append operations works as expected", append_result, expected);