Browse files

some new tests for parse-time

darcs-hash:20080928002851-3cc5d-5b0c7efb205e6a064d02c750e390e029bfb7c5b0.gz
  • Loading branch information...
1 parent 8b3d161 commit 2d0a4db507366f6af75c3ca33d37fd6575053833 @gwkkwg committed Sep 28, 2008
Showing with 53 additions and 1 deletion.
  1. +14 −1 tests/package.lisp
  2. +39 −0 tests/test-date-and-time.lisp
View
15 tests/package.lisp
@@ -3,7 +3,20 @@
(defpackage #:metatilities-test
(:use #:common-lisp #:lift #:metatilities)
(:import-from #:metatilities
+ #:time-year
+ #:time-month
+ #:time-date
+ #:time-hour
+ #:time-minute
+ #:time-second
+ #:day-of-week
+ #:time-daylight-savings-time-p)
+ (:import-from #:metatilities
#:*automatic-slot-accessors?*
#:*automatic-slot-initargs?*
- #:*prune-unknown-slot-options*))
+ #:*prune-unknown-slot-options*)
+ (:import-from #:metatilities
+ #:parse-time
+ )
+ )
View
39 tests/test-date-and-time.lisp
@@ -0,0 +1,39 @@
+(in-package #:metatilities-test)
+
+(deftestsuite test-date-and-time (metatilities-test) ())
+
+(deftestsuite test-parse-time (test-date-and-time) ())
+
+(addtest (test-parse-time)
+ now
+ (ensure-same (get-universal-time) (parse-time "now")))
+
+(addtest (test-parse-time)
+ 1-minute-from-now
+ (ensure-same (+ (get-universal-time) (* 60 1))
+ (parse-time "1 minute from now")))
+
+(addtest (test-parse-time)
+ 1-minute-from-10-12
+ (ensure-same
+ (encode-universal-time 0 13 10 (time-date) (time-month) (time-year))
+ (parse-time "1 minute from 10:12")))
+
+(addtest (test-parse-time)
+ 1-minute-from-specific-date
+ (ensure-same
+ (encode-universal-time 43 13 10 9 9 1989)
+ (parse-time "1 minute from 9/9/89 10:12:43 AM")))
+
+(addtest (test-parse-time)
+ 1-minute
+ (ensure-same 60 (parse-time "1 minute")))
+
+(addtest (test-parse-time)
+ 10-12
+ (ensure-same
+ (encode-universal-time
+ 0 12 10 (time-date) (time-month) (time-year))
+ (parse-time "10:12")))
+
+

0 comments on commit 2d0a4db

Please sign in to comment.