diff options
author | Jeffrey Walton <noloader@gmail.com> | 2021-03-19 13:25:53 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2021-03-19 13:25:53 -0400 |
commit | 20ae15eddeedb265b8f0e15f09e0bfef2ac1e780 (patch) | |
tree | c6cfe27d01b0fd47736076263d7c11439f116b7c /datatest.cpp | |
parent | 2642669c1033900c50d258a3ca4f8692a217097a (diff) | |
download | cryptopp-git-20ae15eddeedb265b8f0e15f09e0bfef2ac1e780.tar.gz |
Add additional code coverage tests
Diffstat (limited to 'datatest.cpp')
-rw-r--r-- | datatest.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/datatest.cpp b/datatest.cpp index c063e652..34d497fe 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -559,6 +559,8 @@ void TestSymmetricCipher(TestData &v, const NameValuePairs &overrideParameters, (void)decryptor->AlgorithmName();
(void)encryptor->AlgorithmProvider();
(void)decryptor->AlgorithmProvider();
+ (void)encryptor->IsRandomAccess();
+ (void)decryptor->IsRandomAccess();
(void)encryptor->MinKeyLength();
(void)decryptor->MinKeyLength();
(void)encryptor->MaxKeyLength();
@@ -946,6 +948,9 @@ void TestDigestOrMAC(TestData &v, bool testDigest, unsigned int &totalTests) // Code coverage
(void)hash->AlgorithmName();
(void)hash->AlgorithmProvider();
+ (void)hash->TagSize();
+ (void)hash->DigestSize();
+ (void)hash->Restart();
}
else
{
@@ -957,6 +962,12 @@ void TestDigestOrMAC(TestData &v, bool testDigest, unsigned int &totalTests) // Code coverage
(void)mac->AlgorithmName();
(void)mac->AlgorithmProvider();
+ (void)mac->TagSize();
+ (void)mac->DigestSize();
+ (void)mac->Restart();
+ (void)mac->MinKeyLength();
+ (void)mac->MaxKeyLength();
+ (void)mac->DefaultKeyLength();
}
if (test == "Verify" || test == "VerifyTruncated" || test == "NotVerify")
@@ -988,7 +999,6 @@ void TestKeyDerivationFunction(TestData &v, unsigned int &totalTests) std::string test = GetRequiredDatum(v, "Test");
if(test == "Skip") return;
- CRYPTOPP_ASSERT(test == "Verify");
std::string secret = GetDecodedDatum(v, "Secret");
std::string expected = GetDecodedDatum(v, "DerivedKey");
@@ -998,6 +1008,12 @@ void TestKeyDerivationFunction(TestData &v, unsigned int &totalTests) member_ptr<KeyDerivationFunction> kdf;
kdf.reset(ObjectFactoryRegistry<KeyDerivationFunction>::Registry().CreateObject(name.c_str()));
+ // Code coverage
+ (void)kdf->AlgorithmName();
+ (void)kdf->AlgorithmProvider();
+ (void)kdf->MinDerivedKeyLength();
+ (void)kdf->MaxDerivedKeyLength();
+
std::string calculated; calculated.resize(expected.size());
kdf->DeriveKey(BytePtr(calculated), BytePtrSize(calculated), BytePtr(secret), BytePtrSize(secret), pairs);
|