X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests.lisp;h=275b9ba0bff9680c4b9f1401e10f68ef36dca07d;hb=d60bf2d464b393bdff8482bcaacd8d49957467ce;hp=2c944aa508f3048bebf26a7eca4cc03be3a52c75;hpb=c8d30e413138f2463ba99a531df2c301cadb206a;p=kmrcl.git diff --git a/tests.lisp b/tests.lisp index 2c944aa..275b9ba 100644 --- a/tests.lisp +++ b/tests.lisp @@ -1,4 +1,4 @@ -;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Package: kmrcl-tests -*- ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; @@ -7,7 +7,7 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Date Started: Apr 2003 ;;;; -;;;; $Id: tests.lisp,v 1.21 2003/07/01 22:16:40 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg ;;;; @@ -102,8 +102,10 @@ (deftest css.4 (concat-separated-strings "|" '("ab" "cd") nil) "ab|cd") (deftest css.5 (concat-separated-strings "|" '("ab" "cd") nil '("ef")) "ab|cd|ef") -(deftest f.1 (filter #'(lambda (x) (when (oddp x) (* x x))) +(deftest f.1 (map-and-remove-nils #'(lambda (x) (when (oddp x) (* x x))) '(0 1 2 3 4 5 6 7 8 9)) (1 9 25 49 81)) +(deftest f.2 (filter #'(lambda (x) (when (oddp x) (* x x))) + '(0 1 2 3 4 5 6 7 8 9)) (1 3 5 7 9)) (deftest an.1 (appendnew '(a b c d) '(c c e f)) (a b c d e f)) @@ -178,6 +180,38 @@ (deftest duqs.4 (decode-uri-query-string "abc+d") "abc d") (deftest duqs.5 (decode-uri-query-string "abc%20d") "abc d") +(deftest sse.1 (string-strip-ending "" nil) "") +(deftest sse.2 (string-strip-ending "abc" nil) "abc") +(deftest sse.3 (string-strip-ending "abc" "ab") "abc") +(deftest sse.4 (string-strip-ending "abc" '("ab")) "abc") +(deftest sse.5 (string-strip-ending "abcd" '("a" "cd")) "ab") + +(deftest mua.1 (match-unique-abbreviation "abc" nil) nil) +(deftest mua.2 (match-unique-abbreviation "abc" '("ab")) nil) +(deftest mua.3 (match-unique-abbreviation "ab" '("ab")) 0) +(deftest mua.4 (match-unique-abbreviation "a" '("ab")) 0) +(deftest mua.5 (match-unique-abbreviation "b" '("ab")) nil) +(deftest mua.6 (match-unique-abbreviation "ab" '("ab" "abc")) nil) +(deftest mua.7 (match-unique-abbreviation "ac" '("ab" "ac")) 1) +(deftest mua.8 (match-unique-abbreviation "ac" '("ab" "acb")) 1) + +(deftest gopt.1 (getopt '("argv") nil) ("argv") nil nil) +(deftest gopt.2 (getopt '("argv" "2") nil) ("argv" "2") nil nil) +(deftest gopt.3 (getopt '("argv" "-c") '(("c" :none))) ("argv") (("c")) nil) +(deftest gopt.4 (getopt '("argv" "-c" "val") '(("c" :optional))) ("argv") (("c" . "val")) nil) +(deftest gopt.5 (getopt '("argv" "-c" "val" "v1") '(("c" :optional))) ("argv" "v1") (("c" . "val")) nil) +(deftest gopt.6 (getopt '("--colon" "val" "v1") '(("colon" :optional))) ( "v1") (("colon" . "val")) nil) +(deftest gopt.7 (getopt '("ab" "--colon" "val" "--" "-c") '(("colon" :optional) ("-c" :none))) ("ab" "-c") (("colon" . "val")) nil) +(deftest gopt.8 (getopt '("argv" "-c" "cd") '(("c" :required))) ("argv") (("c" . "cd")) nil) +(deftest gopt.9 (getopt '("argv" "-c") '(("c" :required))) ("argv") nil ("c")) +(deftest gopt.10 (getopt '("argv" "-c=10") '(("c" :required))) ("argv") (("c" . "10")) nil) +(deftest gopt.11 (getopt '("argv" "-c=10") '(("c" :none))) ("argv") nil ("c")) +(deftest gopt.12 (getopt '("--along=10") '(("along" :optional))) nil (("along" . "10")) nil) +(deftest gopt.13 (getopt '("--along=10") '(("along" :none))) nil nil ("along")) +(deftest gopt.14 (getopt '("--a=10") '(("along" :optional))) nil (("along" . "10")) nil) +(deftest gopt.15 (getopt '("--a=10") '(("along" :optional) ("aboot" :optional))) nil nil ("a")) + + ;;; MOP Testing (eval-when (:compile-toplevel :load-toplevel :execute) @@ -186,8 +220,8 @@ #+kmrtest-mop (progn - (setf (find-class 'credit-rating) nil) (setf (find-class 'monitored-credit-rating) nil) + (setf (find-class 'credit-rating) nil) (defclass credit-rating () ((level :attributes (date-set time-set))