From 281d945ed7d7244182998062764be340230e4494 Mon Sep 17 00:00:00 2001 From: RonaldoCMP Date: Wed, 29 Jul 2020 15:30:35 +0100 Subject: [PATCH] Revert "update" This reverts commit d45f289a9526de09db18ba248dab9b9e9f45b4d0. --- math.scad | 2 +- shapes2d.scad | 1 - tests/test_all.scad | 29 ------------------- tests/test_math.scad | 69 ++++++-------------------------------------- 4 files changed, 10 insertions(+), 91 deletions(-) delete mode 100644 tests/test_all.scad diff --git a/math.scad b/math.scad index 23a8174..a5b12b6 100644 --- a/math.scad +++ b/math.scad @@ -1244,7 +1244,7 @@ function C_div(z1,z2) = // Section: Polynomials -// Function: polynomial() +// Function: polynomial() // Usage: // polynomial(p, z) // Description: diff --git a/shapes2d.scad b/shapes2d.scad index f328952..9622ad4 100644 --- a/shapes2d.scad +++ b/shapes2d.scad @@ -787,7 +787,6 @@ function rect(size=1, center, rounding=0, chamfer=0, anchor, spin=0) = size = is_num(size)? [size,size] : point2d(size), anchor = get_anchor(anchor, center, FRONT+LEFT, FRONT+LEFT), complex = rounding!=0 || chamfer!=0 - , xxx = echo(anchor=anchor)echo(size=size) ) (rounding==0 && chamfer==0)? let( path = [ diff --git a/tests/test_all.scad b/tests/test_all.scad deleted file mode 100644 index c9c89ac..0000000 --- a/tests/test_all.scad +++ /dev/null @@ -1,29 +0,0 @@ -//include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include -include - - diff --git a/tests/test_math.scad b/tests/test_math.scad index eefb18d..3233e6f 100644 --- a/tests/test_math.scad +++ b/tests/test_math.scad @@ -1,17 +1,5 @@ include <../std.scad> -module test_all_numeric() { - assert( all_numeric(1)); - assert( all_numeric([1,2,[3,4]])); - assert( all_numeric([])); - assert(!all_numeric([1,2,[3,"a"]])); - assert(!all_numeric([1,2,[3,true]])); - assert(!all_numeric([1,2,[3,NAN]])); - assert(!all_numeric([1,2,[3,INF]])); - assert( all_numeric([1,2,[3,[]]])); -} -test_all_numeric(); - // Simple Calculations module test_quant() { @@ -122,8 +110,6 @@ module test_approx() { assert_equal(approx(1/3, 0.3333333333), true); assert_equal(approx(-1/3, -0.3333333333), true); assert_equal(approx(10*[cos(30),sin(30)], 10*[sqrt(3)/2, 1/2]), true); - assert_equal(approx([1,[1,undef]], [1+1e-12,[1,true]]), false); - assert_equal(approx([1,[1,undef]], [1+1e-12,[1,undef]]), true); } test_approx(); @@ -356,9 +342,7 @@ module test_cumsum() { assert_equal(cumsum([2,2,2]), [2,4,6]); assert_equal(cumsum([1,2,3]), [1,3,6]); assert_equal(cumsum([-2,-1,0,1,2]), [-2,-3,-3,-2,0]); - assert_equal(cumsum([-2,-1,0,1,2],3), [1,0,0,1,3]); assert_equal(cumsum([[1,2,3], [3,4,5], [5,6,7]]), [[1,2,3],[4,6,8],[9,12,15]]); - assert_equal(cumsum([[1,2,3], [3,4,5], [5,6,7]], [1,0,0]), [[2,2,3],[5,6,8],[10,12,15]]); } test_cumsum(); @@ -405,6 +389,7 @@ module test_mean() { } test_mean(); + module test_median() { assert_equal(median([2,3,7]), 4.5); assert_equal(median([[1,2,3], [3,4,5], [8,9,10]]), [4.5,5.5,6.5]); @@ -412,16 +397,6 @@ module test_median() { test_median(); -module test_convolve() { - assert_equal(convolve([],[1,2,1]), []); - assert_equal(convolve([1,1],[]), []); - assert_equal(convolve([1,1],[1,2,1]), [1,3,3,1]); - assert_equal(convolve([1,2,3],[1,2,1]), [1,4,8,8,3]); -} -test_convolve(); - - - module test_matrix_inverse() { assert_approx(matrix_inverse(rot([20,30,40])), [[0.663413948169,0.556670399226,-0.5,0],[-0.47302145844,0.829769465589,0.296198132726,0],[0.579769465589,0.0400087565481,0.813797681349,0],[0,0,0,1]]); } @@ -608,24 +583,6 @@ module test_factorial() { } test_factorial(); -module test_binomial() { - assert_equal(binomial(1), [1,1]); - assert_equal(binomial(2), [1,2,1]); - assert_equal(binomial(3), [1,3,3,1]); - assert_equal(binomial(5), [1,5,10,10,5,1]); -} -test_binomial(); - -module test_binomial_coefficient() { - assert_equal(binomial_coefficient(2,1), 2); - assert_equal(binomial_coefficient(3,2), 3); - assert_equal(binomial_coefficient(4,2), 6); - assert_equal(binomial_coefficient(10,7), 120); - assert_equal(binomial_coefficient(10,7), binomial(10)[7]); - assert_equal(binomial_coefficient(15,4), binomial(15)[4]); -} -test_binomial_coefficient(); - module test_gcd() { assert_equal(gcd(15,25), 5); @@ -725,7 +682,6 @@ test_linear_solve(); module test_outer_product(){ assert_equal(outer_product([1,2,3],[4,5,6]), [[4,5,6],[8,10,12],[12,15,18]]); - assert_equal(outer_product([1,2],[4,5,6]), [[4,5,6],[8,10,12]]); assert_equal(outer_product([9],[7]), [[63]]); } test_outer_product(); @@ -826,10 +782,8 @@ test_deriv3(); module test_polynomial(){ - assert_equal(polynomial([0],12),0); - assert_equal(polynomial([0],[12,4]),[0,0]); -// assert_equal(polynomial([],12),0); -// assert_equal(polynomial([],[12,4]),[0,0]); + assert_equal(polynomial([],12),0); + assert_equal(polynomial([],[12,4]),[0,0]); assert_equal(polynomial([1,2,3,4],3),58); assert_equal(polynomial([1,2,3,4],[3,-1]),[47,-41]); assert_equal(polynomial([0,0,2],4),2); @@ -925,20 +879,16 @@ test_qr_factor(); module test_poly_mult(){ assert_equal(poly_mult([3,2,1],[4,5,6,7]),[12,23,32,38,20,7]); - assert_equal(poly_mult([3,2,1],[0]),[0]); -// assert_equal(poly_mult([3,2,1],[]),[]); + assert_equal(poly_mult([3,2,1],[]),[]); assert_equal(poly_mult([[1,2],[3,4],[5,6]]), [15,68,100,48]); - assert_equal(poly_mult([[1,2],[0],[5,6]]), [0]); -// assert_equal(poly_mult([[1,2],[],[5,6]]), []); - assert_equal(poly_mult([[3,4,5],[0,0,0]]),[0]); -// assert_equal(poly_mult([[3,4,5],[0,0,0]]),[]); + assert_equal(poly_mult([[1,2],[],[5,6]]), []); + assert_equal(poly_mult([[3,4,5],[0,0,0]]),[]); } test_poly_mult(); - + module test_poly_div(){ - assert_equal(poly_div(poly_mult([4,3,3,2],[2,1,3]), [2,1,3]),[[4,3,3,2],[0]]); -// assert_equal(poly_div(poly_mult([4,3,3,2],[2,1,3]), [2,1,3]),[[4,3,3,2],[]]); + assert_equal(poly_div(poly_mult([4,3,3,2],[2,1,3]), [2,1,3]),[[4,3,3,2],[]]); assert_equal(poly_div([1,2,3,4],[1,2,3,4,5]), [[], [1,2,3,4]]); assert_equal(poly_div(poly_add(poly_mult([1,2,3,4],[2,0,2]), [1,1,2]), [1,2,3,4]), [[2,0,2],[1,1,2]]); assert_equal(poly_div([1,2,3,4], [1,-3]), [[1,5,18],[58]]); @@ -949,8 +899,7 @@ test_poly_div(); module test_poly_add(){ assert_equal(poly_add([2,3,4],[3,4,5,6]),[3,6,8,10]); assert_equal(poly_add([1,2,3,4],[-1,-2,3,4]), [6,8]); - assert_equal(poly_add([1,2,3],-[1,2,3]),[0]); -// assert_equal(poly_add([1,2,3],-[1,2,3]),[]); + assert_equal(poly_add([1,2,3],-[1,2,3]),[]); } test_poly_add();