diff options
author | Jack Lloyd <[email protected]> | 2018-11-02 09:29:10 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-02 09:29:10 -0400 |
commit | 6c0b88066dd81deba23537e4d718291e9cfda7dd (patch) | |
tree | 2bd0d07890d916a60fe46d7e5f63d716764ed98a /src | |
parent | c1b8bc6c01d457155b51cab165c29c290c6eef89 (diff) |
Correct test
This was trying to test for issue in #1723 but was incorrect.
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/test_aead.cpp | 4 | ||||
-rw-r--r-- | src/tests/test_modes.cpp | 2 | ||||
-rw-r--r-- | src/tests/tests.cpp | 14 | ||||
-rw-r--r-- | src/tests/tests.h | 1 |
4 files changed, 18 insertions, 3 deletions
diff --git a/src/tests/test_aead.cpp b/src/tests/test_aead.cpp index c31eaecdf..e8e745487 100644 --- a/src/tests/test_aead.cpp +++ b/src/tests/test_aead.cpp @@ -442,8 +442,8 @@ class AEAD_Tests final : public Text_Based_Test result.test_eq("same provider", enc_provider, dec_provider); // FFI currently requires this, so assure it is true for all modes - result.test_gte("enc buffer sizes ok", enc->update_granularity(), enc->minimum_final_size()); - result.test_gte("dec buffer sizes ok", dec->update_granularity(), dec->minimum_final_size()); + result.test_gt("enc buffer sizes ok", enc->update_granularity(), enc->minimum_final_size()); + result.test_gt("dec buffer sizes ok", dec->update_granularity(), dec->minimum_final_size()); // test enc result.merge(test_enc(key, nonce, input, expected, ad, algo)); diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp index ea74d795a..b371c476b 100644 --- a/src/tests/test_modes.cpp +++ b/src/tests/test_modes.cpp @@ -115,7 +115,7 @@ class Cipher_Mode_Tests final : public Text_Based_Test const size_t min_final_bytes = mode.minimum_final_size(); // FFI currently requires this, so assure it is true for all modes - result.test_gte("buffer sizes ok", update_granularity, min_final_bytes); + result.test_gt("buffer sizes ok", update_granularity, min_final_bytes); result.test_throws("Unkeyed object throws", [&]() { Botan::secure_vector<uint8_t> bad(update_granularity); diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index d26ea7b68..7cc4f1b40 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -316,6 +316,20 @@ bool Test::Result::test_gte(const std::string& what, size_t produced, size_t exp return test_success(); } +bool Test::Result::test_gt(const std::string& what, size_t produced, size_t expected) + { + if(produced <= expected) + { + std::ostringstream err; + err << m_who; + err << " " << what; + err << " unexpected result " << produced << " <= " << expected; + return test_failure(err.str()); + } + + return test_success(); + } + bool Test::Result::test_ne(const std::string& what, const std::string& str1, const std::string& str2) { if(str1 != str2) diff --git a/src/tests/tests.h b/src/tests/tests.h index 2d23f19b5..ad666ff4c 100644 --- a/src/tests/tests.h +++ b/src/tests/tests.h @@ -303,6 +303,7 @@ class Test bool test_lt(const std::string& what, size_t produced, size_t expected); bool test_lte(const std::string& what, size_t produced, size_t expected); + bool test_gt(const std::string& what, size_t produced, size_t expected); bool test_gte(const std::string& what, size_t produced, size_t expected); template<typename T> |