From a3f0de4582a9e512a89ba4099ce0be08b9b11936 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Sat, 25 Apr 2020 16:39:57 +0200 Subject: [PATCH] improved test code --- sciotest/main.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sciotest/main.cpp b/sciotest/main.cpp index 817a151..1ad3533 100644 --- a/sciotest/main.cpp +++ b/sciotest/main.cpp @@ -20,9 +20,10 @@ using namespace std; void print_help() { - std::cout << "usage: sciotest [-h][-v][-t TEST_ID]\n"; + std::cout << "usage: sciotest -h|-v|-t TEST_ID\n"; std::cout << " -h, --help show this help text and exit\n"; - std::cout << " -t, --test perform test with given ID\n"; + std::cout << " -t, --test perform test with given TEST_ID\n"; + std::cout << " currently a number between 1 and 5, inclusive\n"; std::cout << " -v, --version show version number and exit\n"; } @@ -88,8 +89,9 @@ void test5() { file << "A line of text\n"; file.seekg(0); string line; - file >> line; - cout << line; + if (getline(file, line)) { + cout << line << '\n'; + } throw_if_min1(::close(fd)); }