r11092: add clisp mop support; prefixed-number-string macro
[kmrcl.git] / tests.lisp
index 86e86bdbb19ac6f8067f6b0e8ada0b3f0e88c264..b33befd2bb140d1a3fc51bd086e2eb48f9869c96 100644 (file)
@@ -9,7 +9,7 @@
 ;;;;
 ;;;; $Id$
 ;;;;
-;;;; This file is Copyright (c) 2000-2002 by Kevin M. Rosenberg
+;;;; This file is Copyright (c) 2000-2006 by Kevin M. Rosenberg
 ;;;;
 ;;;; *************************************************************************
 
 (deftest :sdstl.4 (string-delimited-string-to-list "ab|cd|ef" "ab")
   ("" "|cd|ef"))
 
+(deftest :hexstr.1 (binary-sequence-to-hex-string ())
+  "")
+
+(deftest :hexstr.2 (binary-sequence-to-hex-string #())
+  "")
+
+(deftest :hexstr.3 (binary-sequence-to-hex-string #(165))
+  "a5"
+)
+
+(deftest :hexstr.4 (binary-sequence-to-hex-string (list 165))
+  "a5")
+
+(deftest :hexstr.5 (binary-sequence-to-hex-string #(165 86))
+  "a556")
+
 (deftest :apsl.1 (append-sublists '((a b) (c d))) (a b c d))
 (deftest :apsl.2 (append-sublists nil) nil)
 (deftest :apsl.3 (append-sublists '((a b))) (a b))
     (make-url "pg" :anchor "then" :vars '(("a" . "5") ("b" . "pi")))
   "pg?a=5&b=pi#then")
 
+(defclass test-unique ()
+  ((a :initarg :a)
+   (b :initarg :b)))
+     
+
+(deftest :unique.1
+    (let ((list (list (make-instance 'test-unique :a 1 :b 1)
+                     (make-instance 'test-unique :a 2 :b 2)
+                     (make-instance 'test-unique :a 3 :b 2))))
+      (values
+       (unique-slot-values list 'a)
+       (unique-slot-values list 'b)))
+  (1 2 3) (1 2))
+
+(deftest :unique.2
+    (unique-slot-values nil 'a)
+  nil)
+
+(deftest :nwp.1     
+       (numbers-within-percentage 1. 1.1 9)
+  nil)
+
+(deftest :nwp.2
+       (numbers-within-percentage 1. 1.1 11)
+  t)
+
+(deftest :pfs.1 (prefixed-fixnum-string 0 #\A 5) "A00000")
+
+(deftest :pfs.2 (prefixed-fixnum-string 1 #\A 5) "A00001")
+
+(deftest :pfs.3 (prefixed-fixnum-string 21 #\B 3) "B021")
+          
+(deftest :pis.4 (prefixed-integer-string 234134 #\C 7) "C0234134")
+          
  ;;; MOP Testing
 
 ;; Disable attrib class until understand changes in sbcl/cmucl