aboutsummaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
authorkaiwu <kaiwu2004@gmail.com>2022-12-06 12:27:42 +0800
committerkaiwu <kaiwu2004@gmail.com>2022-12-06 12:27:42 +0800
commit2811b1bed5cde2d9260d5964e54dc8d3d2b87d49 (patch)
tree14c24f0efbcd50d9ab5b7bcf01acdb5c7d3c8746 /test/test_common.cpp
parentb369fbbe155a79fba2437f822f9507c53a8c35e4 (diff)
downloadadvent-of-code-2811b1bed5cde2d9260d5964e54dc8d3d2b87d49.tar.gz
advent-of-code-2811b1bed5cde2d9260d5964e54dc8d3d2b87d49.zip
2019 day10 part1
Diffstat (limited to 'test/test_common.cpp')
-rw-r--r--test/test_common.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_common.cpp b/test/test_common.cpp
index 06f445a..a74d07e 100644
--- a/test/test_common.cpp
+++ b/test/test_common.cpp
@@ -31,3 +31,12 @@ TEST_CASE("line_view hash", "[common]") {
REQUIRE(h["xyz"] == 2);
REQUIRE(h.find("ab") == h.end());
}
+
+TEST_CASE("common divisor", "[common]") {
+ REQUIRE(gcd(5,5) == 5);
+ REQUIRE(gcd(1,0) == 1);
+ REQUIRE(gcd(0,1) == 1);
+ REQUIRE(gcd(3,2) == 1);
+ REQUIRE(gcd(12,8) == 4);
+ REQUIRE(gcd(9,6) == 3);
+}