(register-test '(suite "List Tests" (suite "firstn" ("returns no items for n = 0" (firstn 0 '(a b c d)) nil) ("returns first n items for n > 0 and n < size of list" (firstn 3 '(a b c d e)) (a b c)) ("returns all items for n > size of list" (firstn 33 '(a b c d e)) (a b c d e))) (suite "nthcdr" ("returns all items for n = 0" (nthcdr 0 '(a b c d)) (a b c d)) ("returns nth cdr of list for n > 0 and n < size of list" (nthcdr 3 '(a b c d e)) (d e)) ("returns nothing for n > size of list" (nthcdr 33 '(a b c d e)) nil)) (suite "car/cdr combinations" ("caar of list" (caar '((x y) (1 2))) x ) ("caar of nil" (caar nil) nil ) ("cadr of list" (cadr '((x y) (1 2))) (1 2) ) ("cadr of nil" (cadr nil) nil ) ("cdar of list" (cdar '((x y) (1 2))) (y) ) ("cdar of nil" (cdar nil) nil ) ("cddr of list" (cddr '(x y 1 2)) (1 2) ) ("cddr of nil" (cddr nil) nil ) ("cadar of list" (cadar '((x y) (1 2))) y ) ("cadar of nil" (cadar nil) nil ) ("caddr of list" (caddr '(x y 1 2)) 1 ) ("caddr of nil" (caddr nil) nil ) ("cdddr of list" (cdddr '(x y 1 2)) (2) ) ("cdddr of nil" (cdddr nil) nil ) ("cadddr of list" (cadddr '(x y 1 2 3)) 2 ) ("cadddr of nil" (cadddr nil) nil )) (suite "proper?" ("t for a proper list" (proper? '(a b c d)) t) ("t for a proper list, even if we write it funny" (proper? '(a b . (c d))) t) ("t for a proper list, even if we write it funny with nil" (proper? '(a b . nil)) t) ("nil for an improper list" (proper? '(a b . c)) nil) ("nil for a very improper list" (proper? '(a b . (c . d))) nil))))