aboutsummaryrefslogtreecommitdiff
path: root/test/test_2015.cpp
diff options
context:
space:
mode:
authorKai WU <kaiwu2004@gmail.com>2022-03-17 22:21:20 +0800
committerKai WU <kaiwu2004@gmail.com>2022-03-17 22:21:20 +0800
commit29b341616a344ee89a776b3031353643b33afb58 (patch)
tree6ec84ab9bb2f66b8acb77333a4c3218d2befe5a0 /test/test_2015.cpp
parent1914eb19f3ce24e59332df7950a83f2d00bf2531 (diff)
downloadadvent-of-code-29b341616a344ee89a776b3031353643b33afb58.tar.gz
advent-of-code-29b341616a344ee89a776b3031353643b33afb58.zip
cal parse
Diffstat (limited to 'test/test_2015.cpp')
-rw-r--r--test/test_2015.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_2015.cpp b/test/test_2015.cpp
index c3b60b9..159e36b 100644
--- a/test/test_2015.cpp
+++ b/test/test_2015.cpp
@@ -91,6 +91,14 @@ TEST_CASE("Probably a Fire Hazard", "[day6]") {
TEST_CASE("Some Assembly Required", "[day 7]") {
aoc2015::cals cals;
- cals.parse("1 OR 2 -> ab");
- printf("%d\n", cals.compute("ab").value);
+ cals.parse("1 -> ab");
+ cals.parse("8 RSHIFT ab -> x");
+ cals.parse("1 LSHIFT x -> ac");
+ cals.parse("ac OR ab -> ae");
+ cals.parse("NOT x -> f");
+ REQUIRE(1 == cals.compute("ab").value);
+ REQUIRE(4 == cals.compute("x").value);
+ REQUIRE(16 == cals.compute("ac").value);
+ REQUIRE(17 == cals.compute("ae").value);
+ REQUIRE(65531 == cals.compute("f").value);
}