diff options
author | lloyd <[email protected]> | 2008-06-16 13:04:17 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-16 13:04:17 +0000 |
commit | ab5d7e841e952f4d946478b68a826247406863e4 (patch) | |
tree | 56fc61fb6de458ea7f981ceed7b503759822d1fd /checks/check.cpp | |
parent | b730ba19274f5422adb70df6d3328c46af35142f (diff) |
Fix -Wmissing-declarations warning
Diffstat (limited to 'checks/check.cpp')
-rw-r--r-- | checks/check.cpp | 83 |
1 files changed, 43 insertions, 40 deletions
diff --git a/checks/check.cpp b/checks/check.cpp index 64b7c0a01..0a7ce373e 100644 --- a/checks/check.cpp +++ b/checks/check.cpp @@ -127,47 +127,8 @@ int main(int argc, char* argv[]) return 0; } -int validate() - { - void test_types(); - - std::cout << "Beginning validation tests..." << std::endl; - - test_types(); - u32bit errors = 0; - try { - errors += do_validation_tests(VALIDATION_FILE); - errors += do_validation_tests(EXPECTED_FAIL_FILE, false); - errors += do_bigint_tests(BIGINT_VALIDATION_FILE); - errors += do_pk_validation_tests(PK_VALIDATION_FILE); - } - catch(Botan::Exception& e) - { - std::cout << "Exception caught: " << e.what() << std::endl; - return 1; - } - catch(std::exception& e) - { - std::cout << "Standard library exception caught: " - << e.what() << std::endl; - return 1; - } - catch(...) - { - std::cout << "Unknown exception caught." << std::endl; - return 1; - } - - if(errors) - { - std::cout << errors << " test" << ((errors == 1) ? "" : "s") - << " failed." << std::endl; - return 1; - } - std::cout << "All tests passed!" << std::endl; - return 0; - } +namespace { template<typename T> bool test(const char* type, int digits, bool is_signed) @@ -219,3 +180,45 @@ void test_types() std::exit(1); } } + +} + +int validate() + { + std::cout << "Beginning validation tests..." << std::endl; + + test_types(); + u32bit errors = 0; + try { + errors += do_validation_tests(VALIDATION_FILE); + errors += do_validation_tests(EXPECTED_FAIL_FILE, false); + errors += do_bigint_tests(BIGINT_VALIDATION_FILE); + errors += do_pk_validation_tests(PK_VALIDATION_FILE); + } + catch(Botan::Exception& e) + { + std::cout << "Exception caught: " << e.what() << std::endl; + return 1; + } + catch(std::exception& e) + { + std::cout << "Standard library exception caught: " + << e.what() << std::endl; + return 1; + } + catch(...) + { + std::cout << "Unknown exception caught." << std::endl; + return 1; + } + + if(errors) + { + std::cout << errors << " test" << ((errors == 1) ? "" : "s") + << " failed." << std::endl; + return 1; + } + + std::cout << "All tests passed!" << std::endl; + return 0; + } |