diff --git a/tests/test_arrays.scad b/tests/test_arrays.scad index a66aeed..3aec4b7 100644 --- a/tests/test_arrays.scad +++ b/tests/test_arrays.scad @@ -589,6 +589,15 @@ module test_array_group() { test_array_group(); +module test_group_data() { + assert_equal(group_data([1,2,0], ["A","B","C"]), [["C"],["A"],["B"]]); + assert_equal(group_data([1,3,0], ["A","B","C"]), [["C"],["A"],[],["B"]]); + assert_equal(group_data([5,3,1], ["A","B","C"]), [[],["C"],[],["B"],[],["A"]]); + assert_equal(group_data([1,3,1], ["A","B","C"]), [[],["A","C"],[],["B"]]); +} +test_group_data(); + + module test_flatten() { assert(flatten([[1,2,3], [4,5,[6,7,8]]]) == [1,2,3,4,5,[6,7,8]]); assert(flatten([]) == []); diff --git a/tests/test_math.scad b/tests/test_math.scad index b5c25b8..ad50ebb 100644 --- a/tests/test_math.scad +++ b/tests/test_math.scad @@ -227,6 +227,26 @@ module test_all_nonnegative() { test_all_nonnegative(); +module test_all_integer() { + assert(!all_integer(undef)); + assert(!all_integer(true)); + assert(!all_integer(false)); + assert(!all_integer(4.3)); + assert(!all_integer("foo")); + assert(!all_integer([])); + assert(!all_integer([3,4.1,5,7])); + assert(!all_integer([[1,2,3],[4,5,6],[7,8]])); + assert(all_integer(-4)); + assert(all_integer(0)); + assert(all_integer(5)); + assert(all_integer([-3])); + assert(all_integer([0])); + assert(all_integer([3])); + assert(all_integer([2,-4,0,5,7,9876543210])); +} +test_all_integer(); + + module test_approx() { assert_equal(approx(PI, 3.141592653589793236), true); assert_equal(approx(PI, 3.1415926), false);