Skip to content

Commit 3515528

Browse files
committed
Make test compatible with sbcl
1 parent e855be9 commit 3515528

2 files changed

Lines changed: 17 additions & 15 deletions

File tree

tests/numbers.lisp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -192,18 +192,19 @@
192192
(equal t
193193
(numberp (parse-integer (format nil "~d" (expt 10 65))))))
194194

195-
;;; test ASH
196-
;;; important note:
197-
;;; at clhs example (ash -100000000000000000000000000000000 -100) => -79
198-
;;; but js op: -100000000000000000000000000000000 >> -100 => 0
199-
;;;
195+
;;; test ASH
200196
(test
201-
(let ((pattern '(32 16 8 0))
197+
(let ((pattern '(32 16 8))
202198
(result (mapcar (lambda (x y) (ash x y))
203-
'(16 16 16 -100000000000000000000000000000000)
204-
'(1 0 -1 -100))))
199+
'(16 16 16)
200+
'(1 0 -1))))
205201
(equal pattern result)))
206202

203+
;;; JSCL-specific: JS bitwise shift gives 0 for this bignum case
204+
;;; CLHS says (ash -100000000000000000000000000000000 -100) => -79
205+
#+jscl
206+
(test (= 0 (ash -100000000000000000000000000000000 -100)))
207+
207208
;;;(equal '(32 16 8 0)
208209
;;; (mapcar (lambda (x y) (ash x y))
209210
;;; '(16 16 16 -100000000000000000000000000000000)
@@ -215,12 +216,9 @@
215216
(ash #xFFFF 2))))
216217

217218
;;; test LOG
218-
(test
219-
(equal 0 (log 1)))
220-
(test
221-
(equal 2 (log 100 10)))
222-
(test
223-
(equal 3 (log 8.0 2)))
219+
(test (zerop (log 1)))
220+
(test (< (abs (- 2 (log 100 10))) 1e-10))
221+
(test (< (abs (- 3 (log 8.0 2))) 1e-10))
224222

225223
;;; test LOGNOT
226224
(test

tests/types.lisp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@
3030
(cons (find-class 'atomic-test-class) 'standard-class)
3131
(cons (let nil (lambda nil nil)) 'function)))
3232

33+
;;; JSCL-specific: tests JSCL's type-of results for +atomic-test-objects+
34+
#+jscl
3335
(test
3436
(mv-eql
3537
(let ((real-type-of)
3638
(idx 0)
39+
(diff0)
3740
(diff1)
3841
(diff2)
3942
(expected-type-of
@@ -441,7 +444,8 @@
441444
(typep #\space 'standard-char))
442445
t t t))
443446

444-
;;; type-of
447+
;;; type-of (JSCL-specific expected values)
448+
#+jscl
445449
(test
446450
(let* ((universum (list 1 'symbol 1.2 #() (make-array '(1 1)) "string" (list) (list 0) t nil)))
447451
(every #'identity

0 commit comments

Comments
 (0)