Skip to content

Commit

Permalink
xlisp #36: require times for gigasecond example and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
William Clifford committed Jan 25, 2015
1 parent 639ae7d commit e6c6426
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions gigasecond/example.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

(in-package #:gigasecond)

(defun from (year month day)
(defun from (year month day hour minute second)
(reverse
(subseq
(multiple-value-list
(decode-universal-time
(+ (encode-universal-time 0 0 0 day month year)
(+ (encode-universal-time second minute hour day month year)
(expt 10 9))))
3 6)))
0 6)))
18 changes: 12 additions & 6 deletions gigasecond/gigasecond-test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@

(in-package #:gigasecond-test)

(define-test from-apr-25-2011
(assert-equal '(2043 1 1) (gigasecond:from 2011 4 25)))
(define-test from-lisp-epoch
(assert-equal '(1931 9 10 1 46 40) (gigasecond:from 1900 1 1 0 0 0)))

(define-test from-jun-13-1977
(assert-equal '(2009 2 19) (gigasecond:from 1977 6 13)))
(define-test from-unix-epoch
(assert-equal '(2001 9 9 2 46 40) (gigasecond:from 1970 1 1 0 0 0)))

(define-test from-jul-19-1959
(assert-equal '(1991 3 27) (gigasecond:from 1959 7 19)))
(define-test from-20110425T120000Z
(assert-equal '(2043 1 1 12 46 40) (gigasecond:from 2011 4 25 12 0 0)))

(define-test from-19770613T235959Z
(assert-equal '(2009 2 20 0 46 39) (gigasecond:from 1977 6 13 23 59 59)))

(define-test from-19590719T123030Z
(assert-equal '(1991 3 27 14 17 10) (gigasecond:from 1959 7 19 12 30 30)))

; customize this to test your birthday and find your gigasecond date:
; (define-test your-birthday
Expand Down

0 comments on commit e6c6426

Please sign in to comment.