Skip to content

Commit e14d805

Browse files
committed
2024 day 21: clean up unit tests
1 parent 6df9899 commit e14d805

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

2024/src/test21.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@
1515
namespace aoc::day21::test {
1616

1717
std::vector<Key> operator""_k(const char *chars, std::size_t len) {
18-
std::vector<Key> keys;
1918
std::istringstream iss(std::string{chars, len});
20-
Key key{};
21-
while (iss >> key) {
22-
keys.push_back(key);
23-
}
24-
return keys;
19+
return aoc::read_vector<Key>(iss);
2520
}
2621

2722
std::size_t test_move_arm() {
@@ -45,21 +40,20 @@ std::size_t test_move_arm() {
4540
std::size_t test_control_arm() {
4641
unit_test::PureTest test("aoc::day21::control_arm", &control_arm);
4742

48-
using enum Key;
4943
test("^"_k, "<A"_k);
5044
test(">"_k, "vA"_k);
5145
test("v"_k, "<vA"_k);
5246
test("<"_k, "v<<A"_k);
5347

5448
test("^A"_k, "<A>A"_k);
55-
test({RIGHT, ACTIVATE}, "vA^A"_k);
56-
test({DOWN, ACTIVATE}, "<vA^>A"_k);
57-
test({LEFT, ACTIVATE}, "v<<A>>^A"_k);
49+
test(">A"_k, "vA^A"_k);
50+
test("vA"_k, "<vA^>A"_k);
51+
test("<A"_k, "v<<A>>^A"_k);
5852

59-
test({UP, DOWN}, "<AvA"_k);
60-
test({UP, LEFT}, "<Av<A"_k);
53+
test("^v"_k, "<AvA"_k);
54+
test("^<"_k, "<Av<A"_k);
6155

62-
test({UP, UP, UP}, "<AAA"_k);
56+
test("^^^"_k, "<AAA"_k);
6357
test("<<>>^A>"_k, "v<<AA>>AA<^A>AvA"_k);
6458

6559
return test.done(), test.num_failed();

0 commit comments

Comments
 (0)