Skip to content

Commit bc37cf0

Browse files
committed
add tests for gcd, lcm
1 parent cf5c2ba commit bc37cf0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

integration_tests/test_math.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from math import (factorial, isqrt, perm, comb, degrees, radians, exp, pow,
2-
ldexp, fabs)
2+
ldexp, fabs, gcd, lcm)
33
from ltypes import i32, f64
44

55

@@ -65,6 +65,21 @@ def test_fabs():
6565
print(i, j)
6666

6767

68+
def test_gcd():
69+
i: i32
70+
i = gcd(10, 4)
71+
assert i == 2
72+
i = gcd(21, 14)
73+
assert i == 7
74+
75+
def test_lcm():
76+
i: i32
77+
i = lcm(10, 4)
78+
assert i == 20
79+
i = lcm(21, 14)
80+
assert i == 42
81+
82+
6883
test_factorial_1()
6984
test_comb()
7085
test_isqrt()
@@ -75,3 +90,5 @@ def test_fabs():
7590
test_pow()
7691
test_fabs()
7792
test_ldexp()
93+
test_gcd()
94+
test_lcm()

0 commit comments

Comments
 (0)