summaryrefslogtreecommitdiff
path: root/validat0.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-09-08 21:52:14 -0400
committerJeffrey Walton <noloader@gmail.com>2018-09-08 21:52:14 -0400
commit9a8b4a80240dc25f0547a76b9bd1054d7e307402 (patch)
treeb1848b6cca2b6ef92f820cdcce7280838f22b650 /validat0.cpp
parentae34c2d2ffcf2dc9791a27427647d8911af52eb6 (diff)
downloadcryptopp-git-9a8b4a80240dc25f0547a76b9bd1054d7e307402.tar.gz
Make TestStringSink a debug test
Diffstat (limited to 'validat0.cpp')
-rw-r--r--validat0.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/validat0.cpp b/validat0.cpp
index eafaf86d..62e5ec30 100644
--- a/validat0.cpp
+++ b/validat0.cpp
@@ -1488,5 +1488,27 @@ bool TestASN1Parse()
}
#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 // CryptoPP