diff --git a/tests/test_queues.scad b/tests/test_queues.scad deleted file mode 100644 index 4ce3c8c..0000000 --- a/tests/test_queues.scad +++ /dev/null @@ -1,77 +0,0 @@ -include <../std.scad> -include <../queues.scad> - - -module test_queue_init() { - assert(queue_init()==[]); -} -test_queue_init(); - - -module test_queue_empty() { - assert(queue_empty([])); - assert(!queue_empty([3])); - assert(!queue_empty([2,4,8])); -} -test_queue_empty(); - - -module test_queue_size() { - assert(queue_size([]) == 0); - assert(queue_size([3]) == 1); - assert(queue_size([2,4,8]) == 3); -} -test_queue_size(); - - -module test_queue_head() { - assert(queue_head([]) == undef); - assert(queue_head([3,5,7,9]) == 3); - assert(queue_head([3,5,7,9], 3) == [3,5,7]); -} -test_queue_head(); - - -module test_queue_tail() { - assert(queue_tail([]) == undef); - assert(queue_tail([3,5,7,9]) == 9); - assert(queue_tail([3,5,7,9], 3) == [5,7,9]); -} -test_queue_tail(); - - -module test_queue_peek() { - q = [8,5,4,3,2,3,7]; - assert(queue_peek(q,0) == 8); - assert(queue_peek(q,2) == 4); - assert(queue_peek(q,2,1) == [4]); - assert(queue_peek(q,2,3) == [4,3,2]); -} -test_queue_peek(); - - -module test_queue_add() { - q1 = queue_init(); - q2 = queue_add(q1, "Foo"); - assert(q2==["Foo"]); - q3 = queue_add(q2, "Bar"); - assert(q3==["Foo","Bar"]); - q4 = queue_add(q3, "Baz"); - assert(q4==["Foo","Bar","Baz"]); -} -test_queue_add(); - - -module test_queue_pop() { - q = ["Foo", "Bar", "Baz", "Qux"]; - q1 = queue_pop(q); - assert(q1 == ["Bar", "Baz", "Qux"]); - q2 = queue_pop(q,2); - assert(q2 == ["Baz", "Qux"]); - q3 = queue_pop(q,3); - assert(q3 == ["Qux"]); -} -test_queue_pop(); - - -// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap diff --git a/tests/test_stacks.scad b/tests/test_stacks.scad deleted file mode 100644 index 7241203..0000000 --- a/tests/test_stacks.scad +++ /dev/null @@ -1,79 +0,0 @@ -include <../std.scad> -include <../stacks.scad> - - -module test_stack_init() { - assert(stack_init()==[]); -} -test_stack_init(); - - -module test_stack_empty() { - assert(stack_empty([])); - assert(!stack_empty([3])); - assert(!stack_empty([2,4,8])); -} -test_stack_empty(); - - -module test_stack_depth() { - assert(stack_depth([]) == 0); - assert(stack_depth([3]) == 1); - assert(stack_depth([2,4,8]) == 3); -} -test_stack_depth(); - - -module test_stack_top() { - assert(stack_top([]) == undef); - assert(stack_top([3,5,7,9]) == 9); - assert(stack_top([3,5,7,9], 3) == [5,7,9]); -} -test_stack_top(); - - -module test_stack_peek() { - s = [8,5,4,3,2,3,7]; - assert(stack_peek(s,0) == 7); - assert(stack_peek(s,2) == 2); - assert(stack_peek(s,2,1) == [2]); - assert(stack_peek(s,2,3) == [2,3,7]); -} -test_stack_peek(); - - -module test_stack_push() { - s1 = stack_init(); - s2 = stack_push(s1, "Foo"); - assert(s2==["Foo"]); - s3 = stack_push(s2, "Bar"); - assert(s3==["Foo","Bar"]); - s4 = stack_push(s3, "Baz"); - assert(s4==["Foo","Bar","Baz"]); -} -test_stack_push(); - - -module test_stack_pop() { - s = ["Foo", "Bar", "Baz", "Qux"]; - s1 = stack_pop(s); - assert(s1 == ["Foo", "Bar", "Baz"]); - s2 = stack_pop(s,2); - assert(s2 == ["Foo", "Bar"]); - s3 = stack_pop(s,3); - assert(s3 == ["Foo"]); -} -test_stack_pop(); - - -module test_stack_rotate() { - s = ["Foo", "Bar", "Baz", "Qux", "Quux"]; - s1 = stack_rotate(s,4); - assert(s1 == ["Foo", "Baz", "Qux", "Quux", "Bar"]); - s2 = stack_rotate(s,-4); - assert(s2 == ["Foo", "Quux", "Bar", "Baz", "Qux"]); -} -test_stack_rotate(); - - -// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap