Skip to content

Commit

Permalink
Fix test suite on ABCL, and probably on ECL and CLisp (#42).
Browse files Browse the repository at this point in the history
For ECL, I implemented `make-char', but then ran into an ECL bug that
kept the test suite from completing
(https://gitlab.com/embeddable-common-lisp/ecl/-/issues/745).

For CLisp, I think the test case was written incorrectly and I have
changed it, but the last CLisp release was in 2010, and when I tried
to build it, it failed.
  • Loading branch information
slburson committed May 19, 2024
1 parent 123695f commit a75a4ec
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Code/port.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@
(defun make-char (code bits)
(code-char (+ code (ash bits 8))))

#+ecl
(defun make-char (code bits)
(code-char (+ code (ash bits 8))))

;;; I'm one of these weird people who detests `loop' (except in its CLtL1 form).
(defmacro while (pred &body body)
`(do () ((not ,pred))
Expand Down
43 changes: 36 additions & 7 deletions Code/testing.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@
(nconc (copy-list vals) list))

(defun run-test-suite (n-iterations &optional random-seed)
(Test-Misc)
;; `Test-Misc' was huge and wouldn't compile in ABCL (JVM function size limitations),
;; so I broke it up.
(Test-Misc-0)
(Test-Misc-1)
(Test-Misc-2)
(Test-Misc-3)
(Test-Reader)
(Test-Rereader)
(Test-Compare-Lexicographically)
Expand All @@ -82,7 +87,7 @@
(Test-Tuple-Operations i))))


(defun Test-Misc ()
(defun Test-Misc-0 ()
"Tests some things that don't need extensive random test cases generated."
(macrolet ((test (form)
`(unless ,form
Expand Down Expand Up @@ -665,8 +670,16 @@
(test (equal (count-if #'evenp (bag 1 2 3) :key '1+) 2))

(test (equal (count-if-not #'evenp (bag 1 2 2 3 4)) 2))
(test (equal (count-if-not #'evenp (bag 1 2 2 3 4) :key #'1+) 3))
(test (equal (count-if-not #'evenp (bag 1 2 2 3 4) :key #'1+) 3)))))

(defun Test-Misc-1 ()
"Tests some things that don't need extensive random test cases generated."
(macrolet ((test (form)
`(unless ,form
(error "Test failed: ~S" ',form))))
(flet ((equal? (a b)
(and (equal? a b)
(equal? b a))))
(locally (declare (notinline empty-map empty-wb-map))
(test (equal (size (empty-map)) 0))
(test (equal (size (empty-map t)) 0))
Expand Down Expand Up @@ -793,8 +806,8 @@
(and (eql (gethash 1 ht) 2)
(eql (gethash 3 ht) 4)
(eql (hash-table-count ht) 2))))
(test (let ((ht (convert 'hash-table (map (1 2) (3 4)) :test 'equal)))
(eql (hash-table-test ht) 'equal)))
(test (let ((ht (convert 'hash-table (map ('(1) 2) ('(3) 4)) :test 'equal)))
(eql (gethash (list 3) ht) 4)))

(test (equal? (map-union (map (0 50) (1 88))
(map (0 51) (1 97))
Expand Down Expand Up @@ -906,8 +919,16 @@
(test (equal (count-if #'evenp (map (1 5) (2 7) (3 9)) :key #'1+) 2))
(test (equal (count-if #'evenp (map (1 5) (2 7) (3 9) (5 17)) :key #'1+) 3))
(test (equal (count-if-not #'evenp (map (1 5) (2 7) (3 9))) 2))
(test (equal (count-if-not #'evenp (map (1 5) (2 7) (3 9)) :key #'1+) 1))
(test (equal (count-if-not #'evenp (map (1 5) (2 7) (3 9)) :key #'1+) 1)))))

(defun Test-Misc-2 ()
"Tests some things that don't need extensive random test cases generated."
(macrolet ((test (form)
`(unless ,form
(error "Test failed: ~S" ',form))))
(flet ((equal? (a b)
(and (equal? a b)
(equal? b a))))
(locally (declare (notinline empty-seq empty-wb-seq))
(test (equal (size (empty-seq)) 0))
(test (empty? (empty-seq)))
Expand Down Expand Up @@ -1517,8 +1538,16 @@
(test (equal? (image (set -3 1 3 21) (seq 0 1 2 3 4 5))
(seq nil t nil t nil nil)))
(test (equal? (image (bag 1 3 3 10) (seq 0 1 2 3 4 5))
(seq nil t nil t nil nil)))
(seq nil t nil t nil nil))))))

(defun Test-Misc-3 ()
"Tests some things that don't need extensive random test cases generated."
(macrolet ((test (form)
`(unless ,form
(error "Test failed: ~S" ',form))))
(flet ((equal? (a b)
(and (equal? a b)
(equal? b a))))
(with-standard-io-syntax
(let ((*package* (find-package :fset))
(*readtable* *fset-readtable*)
Expand Down

0 comments on commit a75a4ec

Please sign in to comment.