Make TestStringSink a debug test
parent
ae34c2d2ff
commit
9a8b4a8024
22
validat0.cpp
22
validat0.cpp
|
|
@ -1488,5 +1488,27 @@ bool TestASN1Parse()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CRYPTOPP_EXTENDED_VALIDATION)
|
||||||
|
bool TestStringSink()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::string in = "The quick brown fox jumps over the lazy dog";
|
||||||
|
|
||||||
|
std::string str;
|
||||||
|
StringSource s1(in, true, new StringSink(str));
|
||||||
|
|
||||||
|
std::vector<byte> vec;
|
||||||
|
StringSource s2(in, true, new VectorSink(vec));
|
||||||
|
|
||||||
|
return str.size() == vec.size() && std::equal(str.begin(), str.end(), vec.begin());
|
||||||
|
}
|
||||||
|
catch(const std::exception&)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
NAMESPACE_END // Test
|
NAMESPACE_END // Test
|
||||||
NAMESPACE_END // CryptoPP
|
NAMESPACE_END // CryptoPP
|
||||||
|
|
|
||||||
23
validat3.cpp
23
validat3.cpp
|
|
@ -41,7 +41,6 @@ bool ValidateAll(bool thorough)
|
||||||
{
|
{
|
||||||
bool pass=TestSettings();
|
bool pass=TestSettings();
|
||||||
pass=TestOS_RNG() && pass;
|
pass=TestOS_RNG() && pass;
|
||||||
pass=TestStringSink() && pass;
|
|
||||||
pass=TestRandomPool() && pass;
|
pass=TestRandomPool() && pass;
|
||||||
#if !defined(NO_OS_DEPENDENCE) && defined(OS_RNG_AVAILABLE)
|
#if !defined(NO_OS_DEPENDENCE) && defined(OS_RNG_AVAILABLE)
|
||||||
pass=TestAutoSeededX917() && pass;
|
pass=TestAutoSeededX917() && pass;
|
||||||
|
|
@ -70,6 +69,8 @@ bool ValidateAll(bool thorough)
|
||||||
pass=TestHuffmanCodes() && pass;
|
pass=TestHuffmanCodes() && pass;
|
||||||
// http://github.com/weidai11/cryptopp/issues/346
|
// http://github.com/weidai11/cryptopp/issues/346
|
||||||
pass=TestASN1Parse() && pass;
|
pass=TestASN1Parse() && pass;
|
||||||
|
// https://github.com/weidai11/cryptopp/pull/334
|
||||||
|
pass=TestStringSink() && pass;
|
||||||
// Always part of the self tests; call in Debug
|
// Always part of the self tests; call in Debug
|
||||||
# if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
|
# if defined(CRYPTOPP_ALTIVEC_AVAILABLE)
|
||||||
pass=TestAltivecOps() && pass;
|
pass=TestAltivecOps() && pass;
|
||||||
|
|
@ -562,26 +563,6 @@ bool TestOS_RNG()
|
||||||
return pass;
|
return pass;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestStringSink()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
std::string in = "The quick brown fox jumps over the lazy dog";
|
|
||||||
|
|
||||||
std::string str;
|
|
||||||
StringSource s1(in, true, new StringSink(str));
|
|
||||||
|
|
||||||
std::vector<byte> vec;
|
|
||||||
StringSource s2(in, true, new VectorSink(vec));
|
|
||||||
|
|
||||||
return str.size() == vec.size() && std::equal(str.begin(), str.end(), vec.begin());
|
|
||||||
}
|
|
||||||
catch(...)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TestRandomPool()
|
bool TestRandomPool()
|
||||||
{
|
{
|
||||||
std::cout << "\nTesting RandomPool generator...\n\n";
|
std::cout << "\nTesting RandomPool generator...\n\n";
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ NAMESPACE_BEGIN(Test)
|
||||||
bool ValidateAll(bool thorough);
|
bool ValidateAll(bool thorough);
|
||||||
bool TestSettings();
|
bool TestSettings();
|
||||||
bool TestOS_RNG();
|
bool TestOS_RNG();
|
||||||
bool TestStringSink();
|
|
||||||
// bool TestSecRandom();
|
// bool TestSecRandom();
|
||||||
bool TestRandomPool();
|
bool TestRandomPool();
|
||||||
#if !defined(NO_OS_DEPENDENCE)
|
#if !defined(NO_OS_DEPENDENCE)
|
||||||
|
|
@ -150,6 +149,8 @@ bool TestRounding();
|
||||||
bool TestHuffmanCodes();
|
bool TestHuffmanCodes();
|
||||||
// http://github.com/weidai11/cryptopp/issues/346
|
// http://github.com/weidai11/cryptopp/issues/346
|
||||||
bool TestASN1Parse();
|
bool TestASN1Parse();
|
||||||
|
// https://github.com/weidai11/cryptopp/pull/334
|
||||||
|
bool TestStringSink();
|
||||||
// Additional tests due to no coverage
|
// Additional tests due to no coverage
|
||||||
bool TestCompressors();
|
bool TestCompressors();
|
||||||
bool TestEncryptors();
|
bool TestEncryptors();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue