aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_ecdsa.cpp
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-19 13:11:49 +0200
committerSimon Warta <[email protected]>2015-06-19 13:11:49 +0200
commit6750b13cc04e4a6a2f1aad364f74d0042d1da766 (patch)
treee4f4ee0dfe1787867218c1d8c334a2382318e057 /src/tests/unit_ecdsa.cpp
parentb9c03ac33472b00a3eeb8bc00b7f37ef610a4eac (diff)
Replace \n by std::endl in tests to ensure proper flushing
- Remove additional newlines in CHECK_MESSAGE call - Remove redundant output of algo in aead_test() Closes #115
Diffstat (limited to 'src/tests/unit_ecdsa.cpp')
-rw-r--r--src/tests/unit_ecdsa.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index ccbd168c7..39e656636 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -29,8 +29,8 @@ using namespace Botan;
#define ECC_TEST_DATA_DIR TEST_DATA_DIR "/ecc"
-#define CHECK_MESSAGE(expr, print) try { if(!(expr)) { ++fails; std::cout << print << "\n"; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << "\n"; }
-#define CHECK(expr) try { if(!(expr)) { ++fails; std::cout << #expr << "\n"; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << "\n"; }
+#define CHECK_MESSAGE(expr, print) try { if(!(expr)) { ++fails; std::cout << print << std::endl; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << std::endl; }
+#define CHECK(expr) try { if(!(expr)) { ++fails; std::cout << #expr << std::endl; } } catch(std::exception& e) { std::cout << __FUNCTION__ << ": " << e.what() << std::endl; }
namespace {
@@ -92,7 +92,7 @@ size_t test_hash_larger_than_n(RandomNumberGenerator& rng)
// verify against EMSA1_BSI
if(pk_verifier.verify_message(message, signature))
{
- std::cout << "Corrupt ECDSA signature verified, should not have\n";
+ std::cout << "Corrupt ECDSA signature verified, should not have" << std::endl;
++fails;
}
@@ -160,7 +160,7 @@ size_t test_sign_then_ver(RandomNumberGenerator& rng)
if(!ok)
{
- std::cout << "ERROR: Could not verify ECDSA signature\n";
+ std::cout << "ERROR: Could not verify ECDSA signature" << std::endl;
fails++;
}
@@ -169,7 +169,7 @@ size_t test_sign_then_ver(RandomNumberGenerator& rng)
if(ok)
{
- std::cout << "ERROR: Bogus ECDSA signature verified anyway\n";
+ std::cout << "ERROR: Bogus ECDSA signature verified anyway" << std::endl;
fails++;
}
@@ -225,7 +225,7 @@ size_t test_ec_sign(RandomNumberGenerator& rng)
}
catch (std::exception& e)
{
- std::cout << "Exception in test_ec_sign - " << e.what() << "\n";
+ std::cout << "Exception in test_ec_sign - " << e.what() << std::endl;
++fails;
}
@@ -241,7 +241,7 @@ size_t test_create_pkcs8(RandomNumberGenerator& rng)
{
RSA_PrivateKey rsa_key(rng, 1024);
//RSA_PrivateKey rsa_key2(1024);
- //cout << "\nequal: " << (rsa_key == rsa_key2) << "\n";
+ //cout << "\nequal: " << (rsa_key == rsa_key2) << std::endl;
//DSA_PrivateKey key(DL_Group("dsa/jce/1024"));
std::ofstream rsa_priv_key(ECC_TEST_DATA_DIR "/rsa_private.pkcs8.pem");
@@ -314,7 +314,7 @@ size_t test_create_and_verify(RandomNumberGenerator& rng)
if(!dynamic_cast<ECDSA_PrivateKey*>(loaded_key.get()))
{
- std::cout << "Failed to reload an ECDSA key with unusual parameter set\n";
+ std::cout << "Failed to reload an ECDSA key with unusual parameter set" << std::endl;
++fails;
}
@@ -372,13 +372,13 @@ size_t test_curve_registry(RandomNumberGenerator& rng)
if(!verifier.verify_message(msg, sig))
{
- std::cout << "Failed testing ECDSA sig for curve " << oids[i] << "\n";
+ std::cout << "Failed testing ECDSA sig for curve " << oids[i] << std::endl;
++fails;
}
}
catch(Invalid_Argument& e)
{
- std::cout << "Error testing curve " << oids[i] << " - " << e.what() << "\n";
+ std::cout << "Error testing curve " << oids[i] << " - " << e.what() << std::endl;
++fails;
}
}
@@ -408,7 +408,7 @@ size_t test_read_pkcs8(RandomNumberGenerator& rng)
catch (std::exception& e)
{
++fails;
- std::cout << "Exception in test_read_pkcs8 - " << e.what() << "\n";
+ std::cout << "Exception in test_read_pkcs8 - " << e.what() << std::endl;
}
try
@@ -431,14 +431,14 @@ size_t test_read_pkcs8(RandomNumberGenerator& rng)
std::unique_ptr<PKCS8_PrivateKey> loaded_key_withdp(
PKCS8::load_key(ECC_TEST_DATA_DIR "/withdompar_private.pkcs8.pem", rng));
- std::cout << "Unexpected success: loaded key with unknown OID\n";
+ std::cout << "Unexpected success: loaded key with unknown OID" << std::endl;
++fails;
}
catch (std::exception) { /* OK */ }
}
catch (std::exception& e)
{
- std::cout << "Exception in test_read_pkcs8 - " << e.what() << "\n";
+ std::cout << "Exception in test_read_pkcs8 - " << e.what() << std::endl;
++fails;
}
@@ -456,13 +456,13 @@ size_t test_ecc_key_with_rfc5915_extensions(RandomNumberGenerator& rng)
if(!dynamic_cast<ECDSA_PrivateKey*>(pkcs8.get()))
{
- std::cout << "Loaded RFC 5915 key, but got something other than an ECDSA key\n";
+ std::cout << "Loaded RFC 5915 key, but got something other than an ECDSA key" << std::endl;
++fails;
}
}
catch(std::exception& e)
{
- std::cout << "Exception in " << BOTAN_CURRENT_FUNCTION << " - " << e.what() << "\n";
+ std::cout << "Exception in " << BOTAN_CURRENT_FUNCTION << " - " << e.what() << std::endl;
++fails;
}