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
d9e6402a
Commit
d9e6402a
authored
22 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
Added more loop tests, for LOOP-AS-ACROSS and LOOP-AS-HASH forms.
parent
6386f0cd
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/ansi-aux.lsp
+2
-0
2 additions, 0 deletions
ansi-tests/ansi-aux.lsp
ansi-tests/gclload2.lsp
+1
-0
1 addition, 0 deletions
ansi-tests/gclload2.lsp
ansi-tests/loop5.lsp
+12
-0
12 additions, 0 deletions
ansi-tests/loop5.lsp
ansi-tests/loop6.lsp
+134
-0
134 additions, 0 deletions
ansi-tests/loop6.lsp
with
149 additions
and
0 deletions
ansi-tests/ansi-aux.lsp
+
2
−
0
View file @
d9e6402a
...
...
@@ -217,6 +217,8 @@ the condition to go uncaught if it cannot be classified."
(defun string-invertcase (s)
(map 'string #'char-invertcase s))
(defun symbol< (x &rest args)
(apply #'string< (symbol-name x) (mapcar #'symbol-name args)))
(defun random-from-seq (seq)
"Generate a random member of a sequence."
...
...
This diff is collapsed.
Click to expand it.
ansi-tests/gclload2.lsp
+
1
−
0
View file @
d9e6402a
...
...
@@ -79,6 +79,7 @@
(load "loop3.lsp")
(load "loop4.lsp")
(load "loop5.lsp")
(load "loop6.lsp")
;;; Tests of conses
...
...
This diff is collapsed.
Click to expand it.
ansi-tests/loop5.lsp
+
12
−
0
View file @
d9e6402a
...
...
@@ -101,8 +101,20 @@
(loop for e across y collect e))
(b c d))
;;; tests of 'as' form
(deftest loop.5.33
(loop as e across "abc" collect e)
(#\a #\b #\c))
(deftest loop.5.34
(loop as e of-type character across "abc" collect e)
(#\a #\b #\c))
(deftest loop.5.35
(loop as e of-type integer across (the simple-vector (coerce '(1 2 3) 'simple-vector))
sum e)
6)
;;; Error cases
...
...
This diff is collapsed.
Click to expand it.
ansi-tests/loop6.lsp
0 → 100644
+
134
−
0
View file @
d9e6402a
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Nov 10 21:13:04 2002
;;;; Contains: Tests for LOOP-AS-HASH forms
(in-package :cl-test)
(defparameter *loop.6.alist*
'((a . 1) (b . 2) (c . 3)))
(defparameter *loop.6.alist.2*
'(("a" . 1) ("b" . 2) ("c" . 3)))
(defparameter *loop.6.alist.3*
'(((a1 . a2) . 1) ((b1 . b2) . 2) ((c1 . c2) . 3)))
(defparameter *loop.6.hash.1*
(let ((table (make-hash-table :test #'eq)))
(loop for (key . val) in *loop.6.alist*
do (setf (gethash key table) val))
table))
(defparameter *loop.6.hash.2*
(let ((table (make-hash-table :test #'eql)))
(loop for (key . val) in *loop.6.alist*
do (setf (gethash key table) val))
table))
(defparameter *loop.6.hash.3*
(let ((table (make-hash-table :test #'equal)))
(loop for (key . val) in *loop.6.alist.3*
do (setf (gethash key table) val))
table))
;;; (defparameter *loop.6.hash.4*
;;; (let ((table (make-hash-table :test #'equalp)))
;;; (loop for (key . val) in *loop.6.alist.2*
;;; do (setf (gethash key table) val))
;;; table))
(defparameter *loop.6.hash.5*
(let ((table (make-hash-table :test #'eql)))
(loop for (val . key) in *loop.6.alist.3*
do (setf (gethash key table) val))
table))
;;; being {each | the} {hash-value | hash-values | hash-key | hash-keys} {in | of }
(deftest loop.6.1
(loop for x being the hash-value of *loop.6.hash.1* sum x)
6)
(deftest loop.6.2
(loop for x being the hash-values of *loop.6.hash.1* sum x)
6)
(deftest loop.6.3
(loop for x being each hash-value of *loop.6.hash.1* sum x)
6)
(deftest loop.6.4
(loop for x being each hash-values of *loop.6.hash.1* sum x)
6)
(deftest loop.6.5
(loop for x being the hash-values in *loop.6.hash.1* sum x)
6)
(deftest loop.6.6
(sort (loop for x being the hash-key of *loop.6.hash.1* collect x)
#'symbol<)
(a b c))
(deftest loop.6.7
(sort (loop for x being the hash-keys of *loop.6.hash.1* collect x)
#'symbol<)
(a b c))
(deftest loop.6.8
(sort (loop for x being each hash-key of *loop.6.hash.1* collect x)
#'symbol<)
(a b c))
(deftest loop.6.9
(sort (loop for x being each hash-keys of *loop.6.hash.1* collect x)
#'symbol<)
(a b c))
(deftest loop.6.10
(sort (loop for x being each hash-keys in *loop.6.hash.1* collect x)
#'symbol<)
(a b c))
(deftest loop.6.11
(sort (loop for (u . v) being the hash-keys of *loop.6.hash.3* collect u)
#'symbol<)
(a1 b1 c1))
(deftest loop.6.12
(sort (loop for (u . v) being the hash-keys of *loop.6.hash.3* collect v)
#'symbol<)
(a2 b2 c2))
(deftest loop.6.13
(sort (loop for (u . v) being the hash-values of *loop.6.hash.5* collect u)
#'symbol<)
(a1 b1 c1))
(deftest loop.6.14
(sort (loop for (u . v) being the hash-values of *loop.6.hash.5* collect v)
#'symbol<)
(a2 b2 c2))
(deftest loop.6.15
(sort (loop for k being the hash-keys of *loop.6.hash.1* using (hash-value v)
collect (list k v))
#'< :key #'second)
((a 1) (b 2) (c 3)))
(deftest loop.6.16
(sort (loop for v being the hash-values of *loop.6.hash.1* using (hash-key k)
collect (list k v))
#'< :key #'second)
((a 1) (b 2) (c 3)))
(deftest loop.6.17
(sort (loop for (u . nil) being the hash-values of *loop.6.hash.5* collect u)
#'symbol<)
(a1 b1 c1))
(deftest loop.6.18
(sort (loop for (nil . v) being the hash-values of *loop.6.hash.5* collect v)
#'symbol<)
(a2 b2 c2))
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