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
969bd93a
Commit
969bd93a
authored
20 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
More pprint-tab tests
parent
80ae0b3e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ansi-tests/pprint-tab.lsp
+111
-0
111 additions, 0 deletions
ansi-tests/pprint-tab.lsp
with
111 additions
and
0 deletions
ansi-tests/pprint-tab.lsp
+
111
−
0
View file @
969bd93a
...
@@ -122,3 +122,114 @@
...
@@ -122,3 +122,114 @@
nil
nil
:margin 1000)
:margin 1000)
(def-pprint-test pprint-tab.section.1
(loop
for prefix-length = (random 50)
for offset = (random 50)
for colnum = (random 50)
for colinc = (min (random 50) (random 50))
for s = (with-output-to-string
(*standard-output*)
(pprint-logical-block
(*standard-output* nil :prefix (make-string prefix-length
:initial-element #\Space))
(dotimes (i offset) (write #\Space))
(pprint-tab :section colnum colinc)
(write #\A)))
for expected-col = (+ prefix-length
(cond ((< offset colnum) colnum)
((= colinc 0) offset)
((= offset colnum) (+ offset colinc))
(t (let ((k (mod (- colnum offset) colinc)))
(if (= k 0)
(+ offset colinc)
(+ offset k))))))
repeat 200
nconc
(unless (string= s (concatenate
'string
(make-string expected-col :initial-element #\Space)
"A"))
(list (list offset colnum colinc expected-col (count #\Space s) s))))
nil
:margin 1000)
(def-pprint-test pprint-tab.line-relative.1
(loop
for offset = (random 100)
for colrel = (random 100)
for colinc = (1+ (min (random 50) (random 50)))
for extra = (mod (- (+ offset colrel)) colinc)
for s = (with-output-to-string
(*standard-output*)
(pprint-logical-block
(*standard-output* nil)
(dotimes (i offset) (write #\Space))
(pprint-tab :line-relative colrel colinc)
(write #\A)))
for expected-col = (+ offset colrel extra)
repeat 200
nconc
(unless (string= s (concatenate
'string
(make-string expected-col :initial-element #\Space)
"A"))
(list (list offset colrel colinc expected-col (count #\Space s) s))))
nil
:margin 1000)
(def-pprint-test pprint-tab.section-relative.1
(loop
for prefix-length = (random 50)
for offset = (random 50)
for colrel = (random 50)
for colinc = (1+ (min (random 50) (random 50)))
for extra = (mod (- (+ offset colrel)) colinc)
for s = (with-output-to-string
(*standard-output*)
(pprint-logical-block
(*standard-output* nil :prefix (make-string prefix-length
:initial-element #\Space))
(dotimes (i offset) (write #\Space))
(pprint-tab :section-relative colrel colinc)
(write #\A)))
for expected-col = (+ prefix-length offset colrel extra)
repeat 200
nconc
(unless (string= s (concatenate
'string
(make-string expected-col :initial-element #\Space)
"A"))
(list (list prefix-length offset colrel colinc extra expected-col (count #\Space s) s))))
nil
:margin 1000)
;;; Error cases
(deftest pprint-tab.error.1
(signals-error (pprint-tab) program-error)
t)
(deftest pprint-tab.error.2
(signals-error (pprint-tab :line) program-error)
t)
(deftest pprint-tab.error.3
(signals-error (pprint-tab :line 1) program-error)
t)
(deftest pprint-tab.error.4
(signals-error (pprint-tab :line 1 1 nil nil) program-error)
t)
(deftest pprint-tab.error.5
(loop for x in *mini-universe*
unless (or (member x '(:line :section :line-relative :section-relative))
(eval `(signals-error (pprint-tab ',x 1 1) error)))
collect x)
nil)
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