From 0a1abb78ef4586b9d6b9d4c8169bca699e4733f7 Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Tue, 20 Sep 2022 00:48:34 -0700 Subject: [PATCH] lmXuu_info() bugfix. ball_bearing_info() bugfix. --- ball_bearings.scad | 2 +- linear_bearings.scad | 39 ++++++++++++++++++--------------- tests/test_linear_bearings.scad | 30 ++++++++----------------- 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/ball_bearings.scad b/ball_bearings.scad index df9cf34..b1dae05 100644 --- a/ball_bearings.scad +++ b/ball_bearings.scad @@ -223,7 +223,7 @@ function ball_bearing_info(trade_size) = ], found = search([trade_size], data, 1)[0] ) - assert(found, str("Unsupported ball bearing trade size: ", trade_size)) + assert(found!=[], str("Unsupported ball bearing trade size: ", trade_size)) select(data[found], 1, -1); diff --git a/linear_bearings.scad b/linear_bearings.scad index 2ea7dc5..b44d9d5 100644 --- a/linear_bearings.scad +++ b/linear_bearings.scad @@ -9,6 +9,9 @@ ////////////////////////////////////////////////////////////////////// +include + + // Section: Generic Linear Bearings // Module: linear_bearing_housing() @@ -152,27 +155,27 @@ function lmXuu_info(size) = let( data = [ // size, diam, length - [ 4.0, 8.0, 12.0], - [ 5.0, 10.0, 15.0], - [ 6.0, 12.0, 19.0], - [ 8.0, 15.0, 24.0], - [ 10.0, 19.0, 29.0], - [ 12.0, 21.0, 30.0], - [ 13.0, 23.0, 32.0], - [ 16.0, 28.0, 37.0], - [ 20.0, 32.0, 42.0], - [ 25.0, 40.0, 59.0], - [ 30.0, 45.0, 64.0], - [ 35.0, 52.0, 70.0], - [ 40.0, 60.0, 80.0], - [ 50.0, 80.0, 100.0], - [ 60.0, 90.0, 110.0], - [ 80.0, 120.0, 140.0], - [100.0, 150.0, 175.0], + [ 4, 8, 12], + [ 5, 10, 15], + [ 6, 12, 19], + [ 8, 15, 24], + [ 10, 19, 29], + [ 12, 21, 30], + [ 13, 23, 32], + [ 16, 28, 37], + [ 20, 32, 42], + [ 25, 40, 59], + [ 30, 45, 64], + [ 35, 52, 70], + [ 40, 60, 80], + [ 50, 80, 100], + [ 60, 90, 110], + [ 80, 120, 140], + [100, 150, 175], ], found = search([size], data, 1)[0] ) - assert(found, str("Unsupported lmXuu linear bearing size: ", size)) + assert(found!=[], str("Unsupported lmXuu linear bearing size: ", size)) select(data[found], 1, -1); diff --git a/tests/test_linear_bearings.scad b/tests/test_linear_bearings.scad index fb57ba5..a30d682 100644 --- a/tests/test_linear_bearings.scad +++ b/tests/test_linear_bearings.scad @@ -2,27 +2,15 @@ include <../std.scad> include <../linear_bearings.scad> -module test_get_lmXuu_bearing_diam() { - assert_equal(get_lmXuu_bearing_diam(4), 8); - assert_equal(get_lmXuu_bearing_diam(8), 15); - assert_equal(get_lmXuu_bearing_diam(10), 19); - assert_equal(get_lmXuu_bearing_diam(25), 40); - assert_equal(get_lmXuu_bearing_diam(50), 80); - assert_equal(get_lmXuu_bearing_diam(100), 150); +module test_lmXuu_info() { + assert_equal(lmXuu_info(4), [8, 12]); + assert_equal(lmXuu_info(8), [15, 24]); + assert_equal(lmXuu_info(10), [19, 29]); + assert_equal(lmXuu_info(25), [40, 59]); + assert_equal(lmXuu_info(50), [80, 100]); + assert_equal(lmXuu_info(100), [150, 175]); } -test_get_lmXuu_bearing_diam(); +test_lmXuu_info(); -module test_get_lmXuu_bearing_length() { - assert_equal(get_lmXuu_bearing_length(4), 12); - assert_equal(get_lmXuu_bearing_length(8), 24); - assert_equal(get_lmXuu_bearing_length(10), 29); - assert_equal(get_lmXuu_bearing_length(25), 59); - assert_equal(get_lmXuu_bearing_length(50), 100); - assert_equal(get_lmXuu_bearing_length(100), 175); -} -test_get_lmXuu_bearing_length(); - - - -// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap +// vim: expandtab shiftwidth=4 softtabstop=4 nowrap