mirror of
https://github.com/revarbat/BOSL2.git
synced 2025-08-11 05:54:15 +02:00
Resolved conflicts with master.
This commit is contained in:
@@ -48,24 +48,33 @@ module test_last() {
|
||||
}
|
||||
test_last();
|
||||
|
||||
module test_delete_last() {
|
||||
|
||||
module test_list_head() {
|
||||
list = [1,2,3,4];
|
||||
assert(delete_last(list) == [1,2,3]);
|
||||
assert(delete_last([1]) == []);
|
||||
assert(delete_last([]) == []);
|
||||
assert_equal(list_head(list), [1,2,3]);
|
||||
assert_equal(list_head([1]), []);
|
||||
assert_equal(list_head([]), []);
|
||||
assert_equal(list_head(list,-3), [1,2]);
|
||||
assert_equal(list_head(list,1), [1,2]);
|
||||
assert_equal(list_head(list,2), [1,2,3]);
|
||||
assert_equal(list_head(list,6), [1,2,3,4]);
|
||||
assert_equal(list_head(list,-6), []);
|
||||
}
|
||||
test_delete_last();
|
||||
test_list_head();
|
||||
|
||||
|
||||
module test_slice() {
|
||||
assert(slice([3,4,5,6,7,8,9], 3, 5) == [6,7]);
|
||||
assert(slice([3,4,5,6,7,8,9], 2, -1) == [5,6,7,8,9]);
|
||||
assert(slice([3,4,5,6,7,8,9], 1, 1) == []);
|
||||
assert(slice([3,4,5,6,7,8,9], 6, -1) == [9]);
|
||||
assert(slice([3,4,5,6,7,8,9], 2, -2) == [5,6,7,8]);
|
||||
assert(slice([], 2, -2) == []);
|
||||
module test_list_tail() {
|
||||
list = [1,2,3,4];
|
||||
assert_equal(list_tail(list), [2,3,4]);
|
||||
assert_equal(list_tail([1]), []);
|
||||
assert_equal(list_tail([]), []);
|
||||
assert_equal(list_tail(list,-3), [2,3,4]);
|
||||
assert_equal(list_tail(list,2), [3,4]);
|
||||
assert_equal(list_tail(list,3), [4]);
|
||||
assert_equal(list_tail(list,6), []);
|
||||
assert_equal(list_tail(list,-6), [1,2,3,4]);
|
||||
}
|
||||
test_slice();
|
||||
test_list_tail();
|
||||
|
||||
|
||||
module test_in_list() {
|
||||
|
Reference in New Issue
Block a user