diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/test_passhash.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/tests/test_passhash.cpp b/src/tests/test_passhash.cpp index 1e83b8d4c..05f53780a 100644 --- a/src/tests/test_passhash.cpp +++ b/src/tests/test_passhash.cpp @@ -36,7 +36,25 @@ class Bcrypt_Tests : public Text_Based_Test Test::Result result("bcrypt"); result.test_eq("correct hash accepted", Botan::check_bcrypt(password, passhash), true); - const size_t max_level = (Test::run_long_tests() ? 14 : 7); + // self-test low levels for each test password + for(size_t level = 4; level <= 6; ++level) + { + const std::string gen_hash = generate_bcrypt(password, Test::rng(), level); + result.test_eq("generated hash accepted", Botan::check_bcrypt(password, gen_hash), true); + } + + return result; + } + + std::vector<Test::Result> run_final_tests() + { + Test::Result result("bcrypt"); + + uint64_t start = Test::timestamp(); + + const std::string password = "ag00d1_2BE5ur3"; + + const size_t max_level = (Test::run_long_tests() ? 15 : 10); for(size_t level = 4; level <= max_level; ++level) { @@ -44,7 +62,9 @@ class Bcrypt_Tests : public Text_Based_Test result.test_eq("generated hash accepted", Botan::check_bcrypt(password, gen_hash), true); } - return result; + result.set_ns_consumed(Test::timestamp() - start); + + return {result}; } }; |