From 9f6a95090faf7627144307e48591a59855693d3e Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Thu, 16 Jan 2020 13:27:50 -0800 Subject: [PATCH] Added regressions for gcd(), lcm(), and factorial() --- tests/test_math.scad | 29 ++++++++++++++++++++++++++++- version.scad | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/tests/test_math.scad b/tests/test_math.scad index 3ec78b7..5a93cfc 100644 --- a/tests/test_math.scad +++ b/tests/test_math.scad @@ -512,7 +512,34 @@ module 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 diff --git a/version.scad b/version.scad index 9dc4670..d4b9c81 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,91]; +BOSL_VERSION = [2,0,92]; // Section: BOSL Library Version Functions