mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2025-01-01 09:49:45 +00:00
commit
68459776e2
28 changed files with 50 additions and 42 deletions
|
@ -91,7 +91,11 @@ function slice(arr,st,end) = let(
|
||||||
// in_list("bar", ["foo", "bar", "baz"]); // Returns true.
|
// in_list("bar", ["foo", "bar", "baz"]); // Returns true.
|
||||||
// in_list("bee", ["foo", "bar", "baz"]); // Returns false.
|
// in_list("bee", ["foo", "bar", "baz"]); // Returns false.
|
||||||
// in_list("bar", [[2,"foo"], [4,"bar"], [3,"baz"]], idx=1); // Returns true.
|
// in_list("bar", [[2,"foo"], [4,"bar"], [3,"baz"]], idx=1); // Returns true.
|
||||||
function in_list(x,l,idx=undef) = search([x], l, num_returns_per_match=1, index_col_num=idx) != [[]];
|
function in_list(val,list,idx=undef) =
|
||||||
|
let( s = search([val], list, num_returns_per_match=1, index_col_num=idx)[0] )
|
||||||
|
s==[] ? false
|
||||||
|
: is_undef(idx) ? val==list[s]
|
||||||
|
: val==list[s][idx];
|
||||||
|
|
||||||
|
|
||||||
// Function: min_index()
|
// Function: min_index()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/hull.scad>
|
include <../hull.scad>
|
||||||
|
|
||||||
|
|
||||||
testpoints_on_sphere = [ for(p =
|
testpoints_on_sphere = [ for(p =
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include<BOSL2/std.scad>
|
include<../std.scad>
|
||||||
include<BOSL2/polyhedra.scad>
|
include<../polyhedra.scad>
|
||||||
|
|
||||||
|
|
||||||
$fn=96;
|
$fn=96;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_ident() {
|
module test_ident() {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
// List/Array Ops
|
// List/Array Ops
|
||||||
|
|
||||||
|
@ -16,6 +15,11 @@ module test_in_list() {
|
||||||
assert(in_list("bar", ["foo", "bar", "baz"]));
|
assert(in_list("bar", ["foo", "bar", "baz"]));
|
||||||
assert(!in_list("bee", ["foo", "bar", "baz"]));
|
assert(!in_list("bee", ["foo", "bar", "baz"]));
|
||||||
assert(in_list("bar", [[2,"foo"], [4,"bar"], [3,"baz"]], idx=1));
|
assert(in_list("bar", [[2,"foo"], [4,"bar"], [3,"baz"]], idx=1));
|
||||||
|
assert(!in_list(undef, [3,4,5]));
|
||||||
|
assert(in_list(undef,[3,4,undef,5]));
|
||||||
|
assert(!in_list(3,[]));
|
||||||
|
assert(!in_list(3,[4,5,[3]]));
|
||||||
|
|
||||||
}
|
}
|
||||||
test_in_list();
|
test_in_list();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_typeof() {
|
module test_typeof() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_point2d() {
|
module test_point2d() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/cubetruss.scad>
|
include <../cubetruss.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_cubetruss_dist() {
|
module test_cubetruss_dist() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_standard_anchors() {
|
module test_standard_anchors() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_is_edge_array() {
|
module test_is_edge_array() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
// Can't test echo output as yet. Include these for coverage calculations.
|
// Can't test echo output as yet. Include these for coverage calculations.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_point_on_segment2d() {
|
module test_point_on_segment2d() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/linear_bearings.scad>
|
include <../linear_bearings.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_get_lmXuu_bearing_diam() {
|
module test_get_lmXuu_bearing_diam() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
// Simple Calculations
|
// Simple Calculations
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_HSL() {
|
module test_HSL() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_square() {
|
module test_square() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/strings.scad>
|
include <../strings.scad>
|
||||||
|
|
||||||
|
|
||||||
function rec_cmp(a,b,eps=1e-9) =
|
function rec_cmp(a,b,eps=1e-9) =
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/queues.scad>
|
include <../queues.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_queue_init() {
|
module test_queue_init() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/hull.scad>
|
include <../hull.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_prismoid() {
|
module test_prismoid() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_turtle() {
|
module test_turtle() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/skin.scad>
|
include <../skin.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_skin() {
|
module test_skin() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/stacks.scad>
|
include <../stacks.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_stack_init() {
|
module test_stack_init() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/strings.scad>
|
include <../strings.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_upcase() {
|
module test_upcase() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/structs.scad>
|
include <../structs.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_struct_set() {
|
module test_struct_set() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_translate() {
|
module test_translate() {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_is_vector() {
|
module test_is_vector() {
|
||||||
|
@ -60,7 +60,7 @@ module test_vabs() {
|
||||||
}
|
}
|
||||||
test_vabs();
|
test_vabs();
|
||||||
|
|
||||||
include <BOSL2/strings.scad>
|
include <../strings.scad>
|
||||||
module test_vang() {
|
module test_vang() {
|
||||||
assert(vang([1,0])==0);
|
assert(vang([1,0])==0);
|
||||||
assert(vang([0,1])==90);
|
assert(vang([0,1])==90);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_bosl_version() {
|
module test_bosl_version() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
include <BOSL2/std.scad>
|
include <../std.scad>
|
||||||
include <BOSL2/vnf.scad>
|
include <../vnf.scad>
|
||||||
|
|
||||||
|
|
||||||
module test_is_vnf() {
|
module test_is_vnf() {
|
||||||
|
|
Loading…
Reference in a new issue