Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ansi-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mark Evenson
ansi-test
Commits
22fa9616
Commit
22fa9616
authored
20 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
More equalp tests
parent
81d302a1
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ansi-tests/equalp.lsp
+181
-0
181 additions, 0 deletions
ansi-tests/equalp.lsp
with
181 additions
and
0 deletions
ansi-tests/equalp.lsp
+
181
−
0
View file @
22fa9616
...
@@ -37,6 +37,187 @@
...
@@ -37,6 +37,187 @@
(equalpt (make-array '(0) :element-type nil) "")
(equalpt (make-array '(0) :element-type nil) "")
t)
t)
(deftest equalp.7
(loop for nbits from 1 to 100
for type = `(unsigned-byte ,nbits)
for bound = (ash 1 nbits)
for val = (random bound)
for a1 = (make-array nil :initial-element val :element-type type)
for a2 = (make-array nil :initial-element val)
unless (equalp a1 a2)
collect (list nbits type val))
nil)
(deftest equalp.8
(loop for nbits from 1 to 100
for type = `(unsigned-byte ,nbits)
for bound = (ash 1 nbits)
for n = (1+ (random 20))
for vals = (loop repeat n collect (random bound))
for a1 = (make-array n :initial-contents vals :element-type type)
for a2 = (make-array n :initial-contents vals)
unless (equalp a1 a2)
collect (list nbits type vals))
nil)
(deftest equalp.9
(loop for nbits from 1 to 100
for type = `(signed-byte ,nbits)
for bound = (ash 1 nbits)
for n = (1+ (random 20))
for vals = (loop repeat n collect (- (random bound) (/ bound 2)))
for a1 = (make-array n :initial-contents vals :element-type type)
for a2 = (make-array n :initial-contents vals)
unless (equalp a1 a2)
collect (list nbits type vals))
nil)
(deftest equalp.10
(equalpt #*0010 #(0 0 1 0))
t)
(deftest equalp.11
(let ((v1 #(1 2 3))
(v2 (make-array 8 :initial-contents '(1 2 3 4 5 6 7 8)
:fill-pointer 3)))
(equalpt v1 v2))
t)
(deftest equalp.12
(equalpt '(#\a #\b) "ab")
nil)
(deftest equalp.13
(equalpt '(#\a #\b) '(#\A #\B))
t)
(deftest equalp.14
(let ((s1 (make-array '(4) :initial-contents '(#\a #\b #\c #\d)
:element-type 'base-char))
(s2 (make-array '(4) :initial-contents '(#\a #\b #\c #\d)
:element-type 'character)))
(equalpt s1 s2))
t)
(deftest equalp.15
(let ((bv (make-array '(4) :initial-contents '(0 0 1 0)
:element-type 'bit))
(v #(0 0 1 0)))
(equalpt bv v))
t)
(defstruct equalp-struct-16
a b c)
(defstruct equalp-struct-16-alt
a b c)
(deftest equalp.16
(let ((s1 (make-equalp-struct-16 :a 1 :b 2 :c #\a))
(s2 (make-equalp-struct-16 :a 1.0 :b 2.0 :c #\A))
(s3 (make-equalp-struct-16-alt :a 1.0 :b 2.0 :c #\A)))
(values (equalpt s1 s2)
(equalpt s1 s3)
(equalpt s2 s3)))
t nil nil)
(deftest equalp.17
(loop for i = (random 1000000)
for f = (float i 1.0s0)
repeat 1000
unless (equalp i f)
collect (list i f))
nil)
(deftest equalp.18
(loop for i = (- (random 10000000) 5000000)
for f = (float i 1.0f0)
repeat 1000
unless (equalp i f)
collect (list i f))
nil)
(deftest equalp.19
(loop for i = (- (random 10000000) 5000000)
for f = (float i 1.0d0)
repeat 1000
unless (equalp i f)
collect (list i f))
nil)
(deftest equalp.20
(loop for i = (- (random 10000000) 5000000)
for f = (float i 1.0l0)
repeat 1000
unless (equalp i f)
collect (list i f))
nil)
(deftest equalp.21
(let ((ht1 (make-hash-table :test #'eq))
(ht2 (make-hash-table :test #'eql))
(ht3 (make-hash-table :test #'equal))
(ht4 (make-hash-table :test #'equalp)))
(values (equalpt ht1 ht2)
(equalpt ht1 ht3)
(equalpt ht1 ht4)
(equalpt ht2 ht3)
(equalpt ht2 ht4)
(equalpt ht3 ht4)))
nil nil nil nil nil nil)
(deftest equalp.22
(equalpt (make-hash-table :test 'eq)
(make-hash-table :test #'eq))
t)
(deftest equalp.23
(equalpt (make-hash-table :test 'eql)
(make-hash-table :test #'eql))
t)
(deftest equalp.24
(equalpt (make-hash-table :test 'equal)
(make-hash-table :test #'equal))
t)
(deftest equalp.25
(equalpt (make-hash-table :test 'equalp)
(make-hash-table :test #'equalp))
t)
(deftest equalp.26
(let ((ht1 (make-hash-table :test #'eq))
(ht2 (make-hash-table :test #'eq)))
(setf (gethash #\a ht1) t)
(setf (gethash #\A ht2) t)
(equalpt ht1 ht2))
nil)
(deftest equalp.27
(let ((ht1 (make-hash-table :test #'eq))
(ht2 (make-hash-table :test #'eq)))
(setf (gethash 'a ht1) #\a)
(setf (gethash 'a ht2) #\A)
(equalpt ht1 ht2))
t)
(deftest equalp.28
(let ((ht1 (make-hash-table :test #'eql))
(ht2 (make-hash-table :test #'eql)))
(setf (gethash #\a ht1) t)
(setf (gethash #\A ht2) t)
(equalpt ht1 ht2))
nil)
(deftest equalp.29
(let ((ht1 (make-hash-table :test #'eql))
(ht2 (make-hash-table :test #'eql)))
(setf (gethash #\a ht1) "a")
(setf (gethash #\a ht2) "A")
(equalpt ht1 ht2))
t)
(deftest equalp.order.1
(deftest equalp.order.1
(let ((i 0) x y)
(let ((i 0) x y)
(values
(values
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment