aboutsummaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-03-14 22:08:10 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-03-14 22:08:10 +0800
commit8cf02f4b8fd6867cb407edc6f4cf0cdfaa883844 (patch)
tree099353396a444517cba9f33e75fcfb35218b74fb /test/test_common.cpp
parent88509ee467b955f9cd23b7d02c16f2f35583cb0d (diff)
downloadadvent-of-code-8cf02f4b8fd6867cb407edc6f4cf0cdfaa883844.tar.gz
advent-of-code-8cf02f4b8fd6867cb407edc6f4cf0cdfaa883844.zip
test common
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);
+}