aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorPhilippe Lieser <[email protected]>2017-04-10 16:56:06 +0200
committerPhilippe Lieser <[email protected]>2017-04-10 16:56:06 +0200
commit2b0a0c3b323d3b8fa09a31420738e0663a4590e8 (patch)
tree44d24a88ad2c393987e4ee2eeee4cc87d0e561f5 /src/tests
parent2f1b5f55d736715c6c15a117bcb70ae582cc7920 (diff)
fix missing flush in DataSink_Stream::end_msg
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_filters.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tests/test_filters.cpp b/src/tests/test_filters.cpp
index ee3e68c1a..b9bd15ced 100644
--- a/src/tests/test_filters.cpp
+++ b/src/tests/test_filters.cpp
@@ -2,6 +2,7 @@
* (C) 2016 Daniel Neus
* 2016 Jack Lloyd
* 2017 René Korthaus
+* 2017 Philippe Lieser
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -35,6 +36,7 @@ class Filter_Tests : public Test
results.push_back(test_secqueue());
results.push_back(test_data_src_sink());
+ results.push_back(test_data_src_sink_flush());
results.push_back(test_pipe_io());
results.push_back(test_pipe_errors());
results.push_back(test_pipe_hash());
@@ -114,6 +116,31 @@ class Filter_Tests : public Test
return result;
}
+ Test::Result test_data_src_sink_flush()
+ {
+ Test::Result result("DataSinkFlush");
+
+#if defined(BOTAN_HAS_CODEC_FILTERS)
+ std::string tmp_name("botan_test_data_src_sink_flush.tmp");
+ std::ofstream outfile(tmp_name);
+
+ Botan::Pipe pipe(new Botan::Hex_Decoder, new Botan::DataSink_Stream(outfile));
+
+ Botan::DataSource_Memory input_mem("65666768");
+ pipe.process_msg(input_mem);
+
+ std::ifstream outfile_read(tmp_name);
+ std::stringstream ss;
+ ss << outfile_read.rdbuf();
+ std::string foo = ss.str();
+
+ result.test_eq("output string", ss.str(), "efgh");
+
+ std::remove(tmp_name.c_str());
+#endif
+ return result;
+ }
+
Test::Result test_pipe_io()
{
Test::Result result("Pipe I/O operators");