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
Container registry
Model registry
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
Michał Herda
ansi-test
Commits
015f0fda
Commit
015f0fda
authored
22 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for :allow-other-keys processing in COUNT, COUNT-IF, COUNT-IF-NOT and FILL.
parent
6f4c0e0b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ansi-tests/count-if-not.lsp
+34
-0
34 additions, 0 deletions
ansi-tests/count-if-not.lsp
ansi-tests/count-if.lsp
+31
-0
31 additions, 0 deletions
ansi-tests/count-if.lsp
ansi-tests/count.lsp
+37
-5
37 additions, 5 deletions
ansi-tests/count.lsp
ansi-tests/fill.lsp
+38
-0
38 additions, 0 deletions
ansi-tests/fill.lsp
with
140 additions
and
5 deletions
ansi-tests/count-if-not.lsp
+
34
−
0
View file @
015f0fda
...
...
@@ -418,6 +418,32 @@
(count-if-not #'%onep a :from-end t)))))
2 3 2 3)
;;; Allow-other-keys tests
(deftest count-if-not.keywords.1
(count-if-not #'oddp '(1 2 3 4 5) :bad t :allow-other-keys t)
2)
(deftest count-if-not.keywords.2
(count-if-not #'oddp '(1 2 3 4 5) :allow-other-keys #p"*" :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest count-if-not.keywords.3
(count-if-not #'oddp '(1 2 3 4 5)
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest count-if-not.keywords.4
(count-if-not #'oddp '(1 2 3 4 5) :key #'identity :key #'1+)
2)
(deftest count-if-not.allow-other-keys.5
(count-if-not #'null '(nil a b c nil) :allow-other-keys nil)
3)
;;; Error tests
(deftest count-if-not.error.1
...
...
@@ -455,3 +481,11 @@
(deftest count-if-not.error.9
(classify-error (count-if-not #'null nil 3 3))
program-error)
;;; Only leftmost :allow-other-keys argument matters
(deftest count-if-not.error.10
(classify-error (count-if-not #'null nil :bad t
:allow-other-keys nil
:allow-other-keys t))
program-error)
This diff is collapsed.
Click to expand it.
ansi-tests/count-if.lsp
+
31
−
0
View file @
015f0fda
...
...
@@ -416,6 +416,30 @@
(count-if #'digit-char-p s :end 2)
(count-if #'digit-char-p s :start 1 :end 2)))
3 3 2 2 1)
;;; Allow-other-keys tests
(deftest count-if.allow-other-keys.1
(count-if #'evenp '(1 2 3 4 5) :bad t :allow-other-keys t)
2)
(deftest count-if.allow-other-keys.2
(count-if #'evenp '(1 2 3 4 5) :allow-other-keys #p"*" :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest count-if.allow-other-keys.3
(count-if #'evenp '(1 2 3 4 5)
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest count-if.allow-other-keys.4
(count-if #'evenp '(1 2 3 4 5) :key #'identity :key #'1+)
2)
;;; Error tests
...
...
@@ -454,3 +478,10 @@
(deftest count-if.error.9
(classify-error (count-if #'null nil 3 3))
program-error)
;;; Only leftmost :allow-other-keys argument matters
(deftest count-if.error.10
(classify-error (count-if #'null nil :bad t
:allow-other-keys nil
:allow-other-keys t))
program-error)
This diff is collapsed.
Click to expand it.
ansi-tests/count.lsp
+
37
−
5
View file @
015f0fda
...
...
@@ -76,7 +76,7 @@
(deftest count-list.16
(count 1 '(1 1 1 3 1 2 1 1) :start 2 :end 7
:test #'(lambda (x y) t))
:test #'(lambda (x y)
(declare (ignore x y))
t))
5)
;;; On vectors
...
...
@@ -152,7 +152,7 @@
(deftest count-vector16
(count 1 #(1 1 1 3 1 2 1 1) :start 2 :end 7
:test #'(lambda (x y) t))
:test #'(lambda (x y)
(declare (ignore x y))
t))
5)
;;; Non-simple vectors
...
...
@@ -257,7 +257,7 @@
(count 1 (make-array 8 :initial-contents '(1 1 1 3 1 2 1 1)
:fill-pointer t)
:start 2 :end 7
:test #'(lambda (x y) t))
:test #'(lambda (x y)
(declare (ignore x y))
t))
5)
(deftest count-filled-vector.17
...
...
@@ -353,7 +353,7 @@
(deftest count-bit-vector.16
(count 1 #*11101101 :start 2 :end 7
:test #'(lambda (x y) t))
:test #'(lambda (x y)
(declare (ignore x y))
t))
5)
(deftest count-bit-vector.17
...
...
@@ -456,7 +456,7 @@
(deftest count-string.16
(count #\1 "11101101" :start 2 :end 7
:test #'(lambda (x y) t))
:test #'(lambda (x y)
(declare (ignore x y))
t))
5)
(deftest count-string.17
...
...
@@ -486,6 +486,32 @@
:start 2 :end 5)
3)
;;; Allow-other-keys tests
(deftest count.allow-other-keys.1
(count 'a '(b a d a c) :bad t :allow-other-keys t)
2)
(deftest count.allow-other-keys.2
(count 'a '(b a d a c) :allow-other-keys #p"*" :also-bad t)
2)
;;; The leftmost of two :allow-other-keys arguments is the one that matters.
(deftest count.allow-other-keys.3
(count 'a '(b a d a c)
:allow-other-keys t
:allow-other-keys nil
:bad t)
2)
(deftest count.allow-other-keys.4
(count 2 '(1 2 3 2 5) :key #'identity :key #'1+)
2)
(deftest count.allow-other-keys.5
(count 'a '(a b c a) :allow-other-keys nil)
2)
;;; Error tests
(deftest count.error.1
...
...
@@ -524,3 +550,9 @@
(classify-error (count nil nil 3 3))
program-error)
;;; Only leftmost :allow-other-keys argument matters
(deftest count.error.10
(classify-error (count 'a nil :bad t
:allow-other-keys nil
:allow-other-keys t))
program-error)
This diff is collapsed.
Click to expand it.
ansi-tests/fill.lsp
+
38
−
0
View file @
015f0fda
...
...
@@ -37,6 +37,11 @@
(classify-error (fill (list 'a 'b) 'c 1 2))
program-error)
(deftest fill.error.10
(classify-error (fill (list 'a 'b) 'c :bad t :allow-other-keys nil
:allow-other-keys t))
program-error)
;;; Fill on arrays
(deftest array-fill-1
...
...
@@ -435,3 +440,36 @@
'bit-vector)))
#*11110000)
;;; Test of :allow-other-keys
(deftest fill.allow-other-keys.1
(fill (list 'a 'b 'c 'd 'e) 'a :allow-other-keys t)
(a a a a a))
(deftest fill.allow-other-keys.2
(fill (list 'a 'b 'c 'd 'e) 'a :allow-other-keys nil)
(a a a a a))
(deftest fill.allow-other-keys.3
(fill (list 'a 'b 'c 'd 'e) 'a :allow-other-keys t :bad t)
(a a a a a))
(deftest fill.allow-other-keys.4
(fill (list 'a 'b 'c 'd 'e) 'a :bad t :allow-other-keys t)
(a a a a a))
(deftest fill.allow-other-keys.5
(fill (list 'a 'b 'c 'd 'e) 'a 'bad t :allow-other-keys t)
(a a a a a))
(deftest fill.allow-other-keys.6
(fill (list 'a 'b 'c 'd 'e) 'a :bad t :allow-other-keys t
:allow-other-keys nil)
(a a a a a))
(deftest fill.allow-other-keys.7
(fill (list 'a 'b 'c 'd 'e) 'a :allow-other-keys t :allow-other-keys nil
:bad t)
(a a a a a))
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