aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/test/lux/data
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/test/lux/data')
-rw-r--r--stdlib/source/test/lux/data/number/int.lux16
-rw-r--r--stdlib/source/test/lux/data/number/nat.lux3
2 files changed, 19 insertions, 0 deletions
diff --git a/stdlib/source/test/lux/data/number/int.lux b/stdlib/source/test/lux/data/number/int.lux
index 33b2927e4..24155602b 100644
--- a/stdlib/source/test/lux/data/number/int.lux
+++ b/stdlib/source/test/lux/data/number/int.lux
@@ -143,6 +143,22 @@
(let [gcd (/.gcd left right)]
(and (/.= +0 (/.% gcd left))
(/.= +0 (/.% gcd right)))))
+ (_.cover [/.extended_gcd]
+ (let [[[left_k right_k] gcd] (/.extended_gcd left right)
+
+ same_gcd!
+ (/.= gcd
+ (/.gcd left right))
+
+ bezout_identity!
+ (/.= gcd
+ (/.+ (/.* left_k left)
+ (/.* right_k right)))]
+ (and same_gcd!
+ bezout_identity!)))
+ (_.cover [/.co-prime?]
+ (bit\= (/.= +1 (/.gcd left right))
+ (/.co-prime? left right)))
(_.cover [/.lcm]
(let [lcm (/.lcm left right)]
(and (/.= +0 (/.% left lcm))
diff --git a/stdlib/source/test/lux/data/number/nat.lux b/stdlib/source/test/lux/data/number/nat.lux
index 97f93dc53..a2d0fd655 100644
--- a/stdlib/source/test/lux/data/number/nat.lux
+++ b/stdlib/source/test/lux/data/number/nat.lux
@@ -112,6 +112,9 @@
(let [gcd (/.gcd left right)]
(and (/.= 0 (/.% gcd left))
(/.= 0 (/.% gcd right)))))
+ (_.cover [/.co-prime?]
+ (bit\= (/.= 1 (/.gcd left right))
+ (/.co-prime? left right)))
(_.cover [/.lcm]
(let [lcm (/.lcm left right)]
(and (/.= 0 (/.% left lcm))