Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
ansi-test
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Karsten Poeck
ansi-test
Commits
70942059
Commit
70942059
authored
Sep 09, 2003
by
pfdietz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial checkin of tests for BOOLE and associated constants.
parent
3fadb795
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
142 additions
and
0 deletions
+142
-0
ansi-tests/boole.lsp
ansi-tests/boole.lsp
+141
-0
ansi-tests/load-numbers.lsp
ansi-tests/load-numbers.lsp
+1
-0
No files found.
ansi-tests/boole.lsp
0 → 100644
View file @
70942059
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Mon Sep 8 20:21:19 2003
;;;; Contains: Tests of BOOLE and associated constants
(in-package :cl-test)
(compile-and-load "numbers-aux.lsp")
(defparameter *boole-val-names*
'(boole-1 boole-2 boole-and boole-andc1 boole-andc2
boole-c1 boole-c2 boole-clr boole-eqv boole-ior
boole-nand boole-nor boole-orc1 boole-orc2 boole-set boole-xor))
(defparameter *boole-vals*
(list boole-1 boole-2 boole-and boole-andc1 boole-andc2
boole-c1 boole-c2 boole-clr boole-eqv boole-ior boole-nand
boole-nor boole-orc1 boole-orc2 boole-set boole-xor))
(defparameter *boole-fns*
(list #'(lambda (x y) (declare (ignore y)) x)
#'(lambda (x y) (declare (ignore x)) y)
#'logand
#'logandc1
#'logandc2
#'(lambda (x y) (declare (ignore y)) (lognot x))
#'(lambda (x y) (declare (ignore x)) (lognot y))
(constantly 0)
#'logeqv
#'logior
#'lognand
#'lognor
#'logorc1
#'logorc2
(constantly -1)
#'logxor))
(deftest boole.error.1
(classify-error (boole))
program-error)
(deftest boole.error.2
(classify-error (boole boole-1))
program-error)
(deftest boole.error.3
(classify-error (boole boole-1 1))
program-error)
(deftest boole.error.4
(classify-error (boole boole-1 1 2 nil))
program-error)
(deftest boole.error.5
(let ((bad (loop for i from 1 until (not (member i *boole-vals*)))))
(eval `(classify-error (boole ,bad 1 1))))
type-error)
(deftest boole.error.6
(loop for n in *boole-val-names*
unless (eq (eval `(classify-error (boole ,n nil 1))) 'type-error)
collect n)
nil)
(deftest boole.error.7
(loop for n in *boole-val-names*
unless (eq (eval `(classify-error (boole ,n 1 nil))) 'type-error)
collect n)
nil)
(deftest boole.1
(loop for v in *boole-vals*
for fn of-type function in *boole-fns*
for n in *boole-val-names*
nconc
(loop for x = (random-fixnum)
for y = (random-fixnum)
for result1 = (funcall (the function fn) x y)
for vals = (multiple-value-list (boole v x y))
for result2 = (car vals)
repeat 100
unless (and (= (length vals) 1) (eql result1 result2))
collect (list n x y result1 result2)))
nil)
(deftest boole.2
(loop for v in *boole-vals*
for fn of-type function in *boole-fns*
for n in *boole-val-names*
nconc
(loop for x = (random-from-interval 1000000000000000)
for y = (random-from-interval 1000000000000000)
for result1 = (funcall (the function fn) x y)
for vals = (multiple-value-list (boole v x y))
for result2 = (car vals)
repeat 100
unless (and (= (length vals) 1) (eql result1 result2))
collect (list n x y result1 result2)))
nil)
(deftest boole.3
(loop for n in *boole-val-names*
for fn of-type function in *boole-fns*
for fn2 = (compile nil `(lambda (x y) (declare (type fixnum x y))
(boole ,n x y)))
nconc
(loop for x = (random-fixnum)
for y = (random-fixnum)
for result1 = (funcall (the function fn) x y)
for vals = (multiple-value-list (funcall fn2 x y))
for result2 = (car vals)
repeat 100
unless (and (= (length vals) 1) (eql result1 result2))
collect (list n x y result1 result2)))
nil)
;;; Order of evaluation
(deftest boole.order.1
(let ((i 0) a b c)
(values
(boole
(progn (setf a (incf i)) boole-and)
(progn (setf b (incf i)) #b1101)
(progn (setf c (incf i)) #b11001))
i a b c))
#b1001 3 1 2 3)
;;; Constants are constants
(deftest boole.constants.1
(eqlt (length *boole-vals*)
(length (remove-duplicates *boole-vals*)))
t)
(deftest boole.constants.2
(remove-if #'constantp *boole-val-names*)
nil)
(deftest boole.constants.3
(remove-if #'boundp *boole-val-names*)
nil)
ansi-tests/load-numbers.lsp
View file @
70942059
...
...
@@ -59,6 +59,7 @@
(load "integerp.lsp")
(load "parse-integer.lsp")
(load "boole.lsp")
(load "rational.lsp")
(load "rationalize.lsp")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment