aboutsummaryrefslogtreecommitdiff
path: root/test/test_common.cpp
diff options
context:
space:
mode:
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);
+}