aboutsummaryrefslogtreecommitdiff
path: root/test/test_2015.cpp
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-03-16 14:37:14 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-03-16 14:37:14 +0800
commitc69f8f28285fd507aa27ae0a18b614f371a2ae1d (patch)
tree9f3da71d7e0395d9a8e7124ae82ccde7e47e5cff /test/test_2015.cpp
parent6aa919cbe332d7e45c0c3a7954d48166f4b774c0 (diff)
downloadadvent-of-code-c69f8f28285fd507aa27ae0a18b614f371a2ae1d.tar.gz
advent-of-code-c69f8f28285fd507aa27ae0a18b614f371a2ae1d.zip
day5 part1
Diffstat (limited to 'test/test_2015.cpp')
-rw-r--r--test/test_2015.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_2015.cpp b/test/test_2015.cpp
index 8eeaf99..03ab285 100644
--- a/test/test_2015.cpp
+++ b/test/test_2015.cpp
@@ -50,6 +50,19 @@ TEST_CASE("The Ideal Stocking Stuffer", "[day4]") {
}
TEST_CASE("Doesn't He Have Intern-Elves For This?", "[day5]") {
- //line_view lv = load_file("../src/2015/day5/input");
+ line_view lv{"adcccfadd", 9};
+ REQUIRE(aoc2015::count_vowels(lv, "aeiou") == 2);
+ REQUIRE(aoc2015::count_vowels(lv, "eiou") == 0);
+ REQUIRE(aoc2015::is_nice(lv, 2));
+ REQUIRE(aoc2015::is_nice(lv, 3));
+ REQUIRE(!aoc2015::is_nice(lv, 4));
+ const char* sub1[] = {"xy", "dx"};
+ const char* sub2[] = {"xy", "fadd", "dx"};
+ REQUIRE(lv.contains(sub2[1]));
+ REQUIRE(aoc2015::is_nice(lv, sub1, ARRAY_SIZE(sub1)));
+ REQUIRE(!aoc2015::is_nice(lv, sub2, ARRAY_SIZE(sub2)));
+
+ line_view ss = load_file("../src/2015/day5/input");
+ REQUIRE(aoc2015::day5(ss) == 255);
}