From 553ac7f353c7043806ec0de70d8630f5cd0a7bb8 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 7 Feb 2021 16:54:16 -0500 Subject: Add QUtil::pipe_file and QUtil::file_provider --- libtests/qutil.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libtests/qutil.cc') diff --git a/libtests/qutil.cc b/libtests/qutil.cc index abfefce0..bc12a6ea 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -483,6 +484,12 @@ void read_from_file_test() assert(memcmp(p, "This file is used for qutil testing.", 36) == 0); assert(p[59] == static_cast(13)); assert(memcmp(p + 24641, "very long.", 10) == 0); + Pl_Buffer b2("buffer"); + // QUtil::file_provider also exercises QUtil::pipe_file + QUtil::file_provider("other-file")(&b2); + auto buf2 = b2.getBuffer(); + assert(buf2->getSize() == size); + assert(memcmp(buf2->getBuffer(), p, size) == 0); } void assert_hex_encode(std::string const& input, std::string const& expected) -- cgit v1.2.3-54-g00ecf