X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Flist.lisp;h=db44b9a91f27fb91a0011f9e9019e32ea6e9b73e;hb=3517907ed86d25003e1f8ae220ef354296d22416;hp=b59f662e36121178efbd2a2a000179e1bed3893c;hpb=64e5f06b85a5f3add27da0136076a41c5924d6ce;p=jscl.git diff --git a/tests/list.lisp b/tests/list.lisp index b59f662..db44b9a 100644 --- a/tests/list.lisp +++ b/tests/list.lisp @@ -228,3 +228,19 @@ (test (equal (multiple-value-list (get-properties '(a b c d) '(b d e))) '(NIL NIL NIL))) (test (equal (multiple-value-list (get-properties '(a b c d) '(b a c))) '(a b (a b c d)))) (test (equal (multiple-value-list (get-properties '(a b c d) '(b c a))) '(a b (a b c d)))) + +;; BUTLAST +(test (equal (butlast '()) ())) +(test (equal (butlast '(1)) ())) +(test (equal (butlast '(1 2)) '(1))) +(test (equal (butlast '(1 2 3 4 5)) '(1 2 3 4))) +(test (equal '(1 2 3 4) (butlast '(1 2 3 4 5)))) +(test (equal (let ((thing '(1 2 3 4 5))) (butlast thing)) '(1 2 3 4))) +(test (equal (let ((thing '(1 2 3 4 5))) (butlast thing) thing) '(1 2 3 4 5))) + +(test (equal (let ((thing '(1 2 3 4 5))) (butlast thing 0)) '(1 2 3 4 5))) +(test (equal (let ((thing '(1 2 3 4 5))) (butlast thing 1)) '(1 2 3 4))) +(test (equal (let ((thing '(1 2 3 4 5))) (butlast thing 2)) '(1 2 3))) +(test (equal (let ((thing '())) (butlast thing 2)) '())) +(test (equal (let ((thing '(1 2))) (butlast thing 2)) '())) +(test (equal (let ((thing '())) (butlast thing 0)) '()))