aboutsummaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_common.cpp')
-rw-r--r--test/test_common.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_common.cpp b/test/test_common.cpp
new file mode 100644
index 0000000..141398b
--- /dev/null
+++ b/test/test_common.cpp
@@ -0,0 +1,15 @@
+#include "catch.hpp"
+#include "common.h"
+
+TEST_CASE("load file", "[]") {
+ line_view file{"\n\n111\n2222\n33333\n", 17};
+ const char* lines[] = {"\n", "\n", "111\n", "2222\n", "33333\n"};
+ int i = 0;
+ per_line(
+ file,
+ [&i](line_view l, const char* lns[]) {
+ REQUIRE(l == lns[i++]);
+ return true;
+ },
+ lines);
+}