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
d46b1f67
Commit
d46b1f67
authored
19 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
Clean up and extended tests
parent
73b746a0
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/decode-universal-time.lsp
+50
-2
50 additions, 2 deletions
ansi-tests/decode-universal-time.lsp
with
50 additions
and
2 deletions
ansi-tests/decode-universal-time.lsp
+
50
−
2
View file @
d46b1f67
...
...
@@ -43,9 +43,11 @@
(deftest decode-universal-time.5
(let ((count 0))
(loop for time =
(let ((x
(random 10000000000)
)) (print x) x)
(loop for time = (random 10000000000)
for (second minute hour date month year day daylight-p zone)
= (multiple-value-list (decode-universal-time time))
= (handler-case
(multiple-value-list (decode-universal-time time))
(error (c) (print time) (error c)))
for time2 = (encode-universal-time second minute hour date month year)
repeat 1000
unless (eql time time2)
...
...
@@ -54,6 +56,52 @@
until (>= count 100)))
nil)
(deftest decode-universal-time.6
(let ((vals0 (multiple-value-list (get-decoded-time)))
(vals1 (multiple-value-list (decode-universal-time (get-universal-time))))
(vals2 (multiple-value-list (get-decoded-time))))
(when (equal vals0 vals2)
(assert (= (length vals1) 9))
(assert (= (length vals2) 9))
(assert (equal (subseq vals1 0 7) (subseq vals2 0 7)))
(assert (if (elt vals1 7) (elt vals2 7) (not (elt vals2 7))))
(assert (= (elt vals1 8) (elt vals2 8))))
(values)))
(deftest decode-universal-time.7
(decode-universal-time (* 365 3600 24) 0)
0 0 0 1 1 1901 1 nil 0)
(deftest decode-universal-time.8
(decode-universal-time (* 2 365 3600 24) 0)
0 0 0 1 1 1902 2 nil 0)
(deftest decode-universal-time.9
(decode-universal-time (* 3 365 3600 24) 0)
0 0 0 1 1 1903 3 nil 0)
(deftest decode-universal-time.10
(decode-universal-time (* 4 365 3600 24) 0)
0 0 0 1 1 1904 4 nil 0)
(deftest decode-universal-time.11
(decode-universal-time (+ (* 24 3600) (* 5 365 3600 24)) 0)
0 0 0 1 1 1905 6 nil 0)
(deftest decode-universal-time.12
(loop for time = (random 100000000000)
for tz = (- (random 49) 24)
for interval = (1+ (random 10000))
for time2 = (+ time (* interval 24 3600))
;; 'time2' is exactly interval days after 'time'
for day = (nth-value 6 (decode-universal-time time tz))
for day2 = (nth-value 6 (decode-universal-time time2 tz))
repeat 1000
;; Check that the days of the week are consistent
unless (= (mod day2 7) (mod (+ day interval) 7))
collect (list time time2 tz interval day day2))
nil)
;;; Error tests
(deftest decode-universal-time.error.1
...
...
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