mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-28 17:30:08 +02:00
Input data check review and some refactoring
Some functions have been changed as a consequence of the dat checking review. vector_axis was fully refactored. add_scalar was moved to arrays.scad
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include <BOSL2/std.scad>
|
||||
include <../std.scad>
|
||||
|
||||
|
||||
module test_is_vector() {
|
||||
@@ -9,17 +9,14 @@ module test_is_vector() {
|
||||
assert(is_vector(1) == false);
|
||||
assert(is_vector("foo") == false);
|
||||
assert(is_vector(true) == false);
|
||||
assert(is_vector([0,0],nonzero=true) == false);
|
||||
assert(is_vector([0,1e-12,0],nonzero=true) == false);
|
||||
assert(is_vector([0,1e-6,0],nonzero=true) == true);
|
||||
assert(is_vector([0,1e-6,0],nonzero=true,eps=1e-4) == false);
|
||||
}
|
||||
test_is_vector();
|
||||
|
||||
|
||||
module test_add_scalar() {
|
||||
assert(add_scalar([1,2,3],3) == [4,5,6]);
|
||||
assert(add_scalar([[1,2,3],[3,4,5]],3) == [[4,5,6],[6,7,8]]);
|
||||
}
|
||||
test_add_scalar();
|
||||
|
||||
|
||||
module test_vfloor() {
|
||||
assert_equal(vfloor([2.0, 3.14, 18.9, 7]), [2,3,18,7]);
|
||||
assert_equal(vfloor([-2.0, -3.14, -18.9, -7]), [-2,-4,-19,-7]);
|
||||
@@ -56,7 +53,7 @@ module test_vabs() {
|
||||
}
|
||||
test_vabs();
|
||||
|
||||
include <BOSL2/strings.scad>
|
||||
include <../strings.scad>
|
||||
module test_vang() {
|
||||
assert(vang([1,0])==0);
|
||||
assert(vang([0,1])==90);
|
||||
|
Reference in New Issue
Block a user