r1795: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 Apr 2002 16:10:55 +0000 (16:10 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 Apr 2002 16:10:55 +0000 (16:10 +0000)
test-suite/tester-clsql.cl

index 1e3fd7838364566d47cde65b1f1ff572e3cd1dd9..00c2e7e8d86fd588a085216c702c008e5a90c0d7 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Mar 2002
 ;;;;
-;;;; $Id: tester-clsql.cl,v 1.6 2002/04/23 18:28:02 kevin Exp $
+;;;; $Id: tester-clsql.cl,v 1.7 2002/04/24 16:10:55 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
          :test #'eql
          :fail-info 
          (format nil "Wrong float value ~A for int ~A (row ~S)" float int row))
-    (test (parse-double str)
-         float
-         :test #'eql
-         :fail-info (format nil "Wrong string value ~A for double ~A (row ~S)"
-                            float str row))))
-
-
+    (test float
+         (parse-double str)
+         :test #'double-float-equal
+         :fail-info (format nil "Wrong string value ~A for double ~A~%Row: ~S"
+                            str float row))))
+
+
+(defun double-float-equal (a b)
+  (if (zerop a)
+      (if (zerop b)
+         t
+         nil)
+      (let ((diff (abs (/ (- a b) a))))
+       (if (> diff (* 10 double-float-epsilon))
+           nil
+           t))))
+        
 (defun drop-test-table (db)
   (clsql:execute-command "DROP TABLE test_clsql"))