diff options
author | lloyd <[email protected]> | 2014-01-05 06:23:21 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-05 06:23:21 +0000 |
commit | c431fb65b883a0a5fa060ea7caace0aca3628ec6 (patch) | |
tree | 09898d2307801bffa7e1aeee9251d57ed4837870 /src/tests/tests.cpp | |
parent | 052345203b67eb5cacacd5659ec9837eeb59af35 (diff) |
Split up public key tests and data, use new test framework
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index fdcfae06a..e9b07ea75 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -45,7 +45,7 @@ size_t run_tests_bb(std::istream& src, const std::string& name_key, const std::string& output_key, bool clear_between_cb, - std::function<bool (std::map<std::string, std::string>)> cb) + std::function<size_t (std::map<std::string, std::string>)> cb) { if(!src.good()) { @@ -94,14 +94,16 @@ size_t run_tests_bb(std::istream& src, if(key == output_key) { - //std::cout << vars[name_key] << " " << test_cnt << "\n"; + //std::cout << vars[name_key] << " " << algo_count << "\n"; ++algo_count; try { - if(!cb(vars)) + const size_t fails = cb(vars); + + if(fails) { - std::cout << vars[name_key] << " test " << algo_count << " failed\n"; - ++algo_fail; + std::cout << vars[name_key] << " test " << algo_count << ": " << fails << " failure\n"; + algo_fail += fails; } } catch(std::exception& e) @@ -143,9 +145,9 @@ size_t run_tests(std::istream& src, { std::cout << name_key << ' ' << vars[name_key] << " got " << got << " expected " << vars[output_key] << std::endl; - return false; + return 1; } - return true; + return 0; }); } @@ -181,10 +183,20 @@ int test_main(int argc, char* argv[]) DEF_TEST(cryptobox); DEF_TEST(tss); DEF_TEST(bigint); - DEF_TEST(pubkey); - DEF_TEST(ecc); + + DEF_TEST(rsa); + DEF_TEST(rw); + DEF_TEST(dsa); + DEF_TEST(nr); + DEF_TEST(dh); + DEF_TEST(dlies); + DEF_TEST(elgamal); DEF_TEST(ecdsa); - DEF_TEST(ecdh); + DEF_TEST(gost_3410); + + DEF_TEST(ecc_unit); + DEF_TEST(ecdsa_unit); + DEF_TEST(ecdh_unit); DEF_TEST(pk_keygen); DEF_TEST(cvc); DEF_TEST(x509); |