Add seconds-to-condensed-time-string
[kmrcl.git] / tests.lisp
index 7ab59b369b08452956c9a92c4489e9026b593edb..11c7f98758850225bb2a74de7a0be4d068395f7e 100644 (file)
      (encode-universal-time 0 0 0 1 11 2000)) nil)
 )
 
+(deftest :sts.1
+    (seconds-to-condensed-time-string 0) "0s")
+(deftest :sts.2
+    (seconds-to-condensed-time-string 60) "1m0s")
+(deftest :sts.3
+    (seconds-to-condensed-time-string 65) "1m5s")
+(deftest :sts.4
+    (seconds-to-condensed-time-string 3600) "1h0m0s")
+(deftest :sts.5
+    (seconds-to-condensed-time-string 36000) "10h0m0s")
+(deftest :sts.6
+    (seconds-to-condensed-time-string 86400) "1d0h0m0s")
+(deftest :sts.7
+    (seconds-to-condensed-time-string (* 7 86400)) "1w0d0h0m0s")
+(deftest :sts.8
+    (seconds-to-condensed-time-string (* 21 86400)) "3w0d0h0m0s")
+(deftest :sts.9
+    (seconds-to-condensed-time-string (+ 86400 7200 120 50 (* 21 86400))) "3w1d2h2m50s")
+(deftest :sts.10
+    (seconds-to-condensed-time-string (+ .1 86400 7200 120 50 (* 21 86400))
+                                      :dp-digits 1) "3w1d2h2m50.1s")
 
 (deftest :ekdc.1
     (ensure-keyword-default-case (read-from-string "TYPE")) :type)