From 1e934def566832c2722c63d5b48df631996c6e88 Mon Sep 17 00:00:00 2001 From: HarmoGlace <23212967+HarmoGlace@users.noreply.github.com> Date: Wed, 19 Apr 2023 16:18:31 +0200 Subject: Add `gcd` and `lcm` calculation methods (#789) --- tests/typ/compute/calc.typ | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/typ/compute/calc.typ b/tests/typ/compute/calc.typ index c9e23542..6af5189b 100644 --- a/tests/typ/compute/calc.typ +++ b/tests/typ/compute/calc.typ @@ -146,6 +146,30 @@ #test(calc.binom(5, 6), 0) #test(calc.binom(6, 2), 15) +--- +// Test the `gcd` function. +#test(calc.gcd(112, 77), 7) +#test(calc.gcd(12, 96), 12) +#test(calc.gcd(13, 9), 1) +#test(calc.gcd(13, -9), 1) +#test(calc.gcd(272557, 272557), 272557) +#test(calc.gcd(0, 0), 0) +#test(calc.gcd(7, 0), 7) + +--- +// Test the `lcm` function. +#test(calc.lcm(112, 77), 1232) +#test(calc.lcm(12, 96), 96) +#test(calc.lcm(13, 9), 117) +#test(calc.lcm(13, -9), 117) +#test(calc.lcm(272557, 272557), 272557) +#test(calc.lcm(0, 0), 0) +#test(calc.lcm(8, 0), 0) + +--- +// Error: 10-41 the return value is too large +#calc.lcm(15486487489457, 4874879896543) + --- // Error: 10-12 expected at least one value #calc.min() -- cgit v1.2.3