mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
Added regressions for gcd(), lcm(), and factorial()
This commit is contained in:
parent
68260afebb
commit
9f6a95090f
2 changed files with 29 additions and 2 deletions
|
@ -512,7 +512,34 @@ module test_count_true() {
|
||||||
test_count_true();
|
test_count_true();
|
||||||
|
|
||||||
|
|
||||||
cube();
|
module test_factorial() {
|
||||||
|
assert(factorial(1) == 1);
|
||||||
|
assert(factorial(2) == 2);
|
||||||
|
assert(factorial(3) == 6);
|
||||||
|
assert(factorial(4) == 24);
|
||||||
|
assert(factorial(5) == 120);
|
||||||
|
assert(factorial(6) == 720);
|
||||||
|
assert(factorial(7) == 5040);
|
||||||
|
assert(factorial(8) == 40320);
|
||||||
|
}
|
||||||
|
test_factorial();
|
||||||
|
|
||||||
|
|
||||||
|
module test_gcd() {
|
||||||
|
assert(gcd(15,25) == 5);
|
||||||
|
assert(gcd(15,27) == 3);
|
||||||
|
assert(gcd(270,405) == 135);
|
||||||
|
}
|
||||||
|
test_gcd();
|
||||||
|
|
||||||
|
|
||||||
|
module test_lcm() {
|
||||||
|
assert(lcm(15,25) == 75);
|
||||||
|
assert(lcm(15,27) == 135);
|
||||||
|
assert(lcm(270,405) == 810);
|
||||||
|
}
|
||||||
|
test_lcm();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
// vim: noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
BOSL_VERSION = [2,0,91];
|
BOSL_VERSION = [2,0,92];
|
||||||
|
|
||||||
|
|
||||||
// Section: BOSL Library Version Functions
|
// Section: BOSL Library Version Functions
|
||||||
|
|
Loading…
Reference in a new issue