From 68260afebb12fd9e1776dc3045b51f9864829a2f Mon Sep 17 00:00:00 2001 From: Revar Desmera Date: Thu, 16 Jan 2020 13:01:41 -0800 Subject: [PATCH] Added regressions for permute() and repeat_entries() --- tests/test_arrays.scad | 16 ++++++++++++++++ version.scad | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/test_arrays.scad b/tests/test_arrays.scad index d0213bc..be6b4ab 100644 --- a/tests/test_arrays.scad +++ b/tests/test_arrays.scad @@ -294,6 +294,22 @@ module test_triplet_wrap() { test_triplet_wrap(); +module test_permute() { + assert(permute([3,4,5,6]) == [[3,4],[3,5],[3,6],[4,5],[4,6],[5,6]]); + assert(permute([3,4,5,6],n=3) == [[3,4,5],[3,4,6],[3,5,6],[4,5,6]]); +} +test_permute(); + + +module test_repeat_entries() { + list = [0,1,2,3]; + assert(repeat_entries(list, 6) == [0,0,1,2,2,3]); + assert(repeat_entries(list, 6, exact=false) == [0,0,1,1,2,2,3,3]); + assert(repeat_entries(list, [1,1,2,1], exact=false) == [0,1,2,2,3]); +} +test_repeat_entries(); + + module test_zip() { v1 = [1,2,3,4]; v2 = [5,6,7]; diff --git a/version.scad b/version.scad index edc9da7..9dc4670 100644 --- a/version.scad +++ b/version.scad @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////////////// -BOSL_VERSION = [2,0,90]; +BOSL_VERSION = [2,0,91]; // Section: BOSL Library Version Functions