From 4f4c627b77a169e1729982fa03dd75d5035f0297 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 4 Aug 2018 19:50:21 -0400 Subject: ClosedFileInputSource: add method to keep file open During periods of intensive operation on a specific file, this method can reduce the overhead of repeated open/close operations. --- libtests/closed_file_input_source.cc | 5 +++++ libtests/qtest/closedfile/output | 1 + 2 files changed, 6 insertions(+) (limited to 'libtests') diff --git a/libtests/closed_file_input_source.cc b/libtests/closed_file_input_source.cc index 9cf5ff04..7309ca31 100644 --- a/libtests/closed_file_input_source.cc +++ b/libtests/closed_file_input_source.cc @@ -65,6 +65,11 @@ int main() std::cout << "testing with ClosedFileInputSource\n"; ClosedFileInputSource cf("input"); do_tests(&cf); + std::cout << "testing with ClosedFileInputSource in stay open mode\n"; + ClosedFileInputSource cf2("input"); + cf2.stayOpen(true); + do_tests(&cf2); + cf2.stayOpen(false); std::cout << "testing with FileInputSource\n"; FileInputSource f; f.setFilename("input"); diff --git a/libtests/qtest/closedfile/output b/libtests/qtest/closedfile/output index 7a5554af..596d1462 100644 --- a/libtests/qtest/closedfile/output +++ b/libtests/qtest/closedfile/output @@ -1,3 +1,4 @@ testing with ClosedFileInputSource +testing with ClosedFileInputSource in stay open mode testing with FileInputSource all assertions passed -- cgit v1.2.3-70-g09d2