diff options
Diffstat (limited to 'src/tests/test_utils.cpp')
-rw-r--r-- | src/tests/test_utils.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp index 8c1d353b4..a1e583cd8 100644 --- a/src/tests/test_utils.cpp +++ b/src/tests/test_utils.cpp @@ -16,7 +16,7 @@ #include <botan/parsing.h> #if defined(BOTAN_HAS_BASE64_CODEC) - #include <botan/base64.h> + #include <botan/base64.h> #endif namespace Botan_Tests { @@ -26,8 +26,7 @@ namespace { class Utility_Function_Tests : public Text_Based_Test { public: - Utility_Function_Tests() : Text_Based_Test("util.vec","In1,In2,Out") - {} + Utility_Function_Tests() : Text_Based_Test("util.vec", "In1,In2,Out") {} Test::Result run_one_test(const std::string& algo, const VarMap& vars) override { @@ -181,17 +180,18 @@ BOTAN_REGISTER_TEST("util", Utility_Function_Tests); class Date_Format_Tests : public Text_Based_Test { public: - Date_Format_Tests() : Text_Based_Test("dates.vec", "Date") - {} + Date_Format_Tests() : Text_Based_Test("dates.vec", "Date") {} std::vector<uint32_t> parse_date(const std::string& s) { const std::vector<std::string> parts = Botan::split_on(s, ','); if(parts.size() != 6) + { throw Test_Error("Bad date format '" + s + "'"); + } std::vector<uint32_t> u32s; - for(auto&& sub : parts) + for(auto const& sub : parts) { u32s.push_back(Botan::to_u32bit(sub)); } @@ -231,8 +231,7 @@ class Date_Format_Tests : public Text_Based_Test } else if(type == "invalid") { - result.test_throws("invalid date", - [d]() { Botan::calendar_point c(d[0], d[1], d[2], d[3], d[4], d[5]); }); + result.test_throws("invalid date", [d]() { Botan::calendar_point c(d[0], d[1], d[2], d[3], d[4], d[5]); }); } else { @@ -337,8 +336,7 @@ BOTAN_REGISTER_TEST("base64", Base64_Tests); class Charset_Tests : public Text_Based_Test { public: - Charset_Tests() : Text_Based_Test("charset.vec", "In,Out") - {} + Charset_Tests() : Text_Based_Test("charset.vec", "In,Out") {} Test::Result run_one_test(const std::string& type, const VarMap& vars) override { @@ -385,8 +383,8 @@ class Charset_Tests : public Text_Based_Test { // "abcdefŸabcdef" std::vector<uint8_t> input = { 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66, 0x01, - 0x78, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66 - }; + 0x78, 0x00, 0x61, 0x00, 0x62, 0x00, 0x63, 0x00, 0x64, 0x00, 0x65, 0x00, 0x66 + }; Charset::transcode(std::string(input.begin(), input.end()), Character_Set::LATIN1_CHARSET, Character_Set::UCS2_CHARSET); @@ -413,8 +411,8 @@ class Charset_Tests : public Text_Based_Test { // "abcdefŸabcdef" std::vector<uint8_t> input = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0xC5, - 0xB8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 - }; + 0xB8, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66 + }; Charset::transcode(std::string(input.begin(), input.end()), Character_Set::LATIN1_CHARSET, Character_Set::UTF8_CHARSET); @@ -473,7 +471,7 @@ class Hostname_Tests : public Text_Based_Test const bool expected = (type == "Invalid") ? false : true; const std::string what = hostname + ((expected == true) ? - " matches " : " does not match ") + issued; + " matches " : " does not match ") + issued; result.test_eq(what, Botan::host_wildcard_match(issued, hostname), expected); return result; |