]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/calendar/calendar-tests.factor
#2845 : Platform specific documentation responders
[factor.git] / basis / calendar / calendar-tests.factor
index a3a5772d89b559dd364e1590979856664e06caba..0cac2525195236272e3b81702cad528fc7a9a7fa 100644 (file)
@@ -199,7 +199,7 @@ IN: calendar
 
 { t } [
     2009 1 29 <date> 1 months time+
-    2009 3 1 <date> =
+    2009 2 28 <date> =
 ] unit-test
 
 { t } [
@@ -231,19 +231,19 @@ IN: calendar
 
 {
     T{ timestamp { year 2019 } { month 11 } { day 4 } }
-} [ 2019 308 year-ordinal>timestamp >gmt midnight ] unit-test
+} [ 2019 308 year-ordinal>timestamp ] unit-test
 
 {
     T{ timestamp { year 2020 } { month 11 } { day 3 } }
-} [ 2020 308 year-ordinal>timestamp >gmt midnight ] unit-test
+} [ 2020 308 year-ordinal>timestamp ] unit-test
 
 {
     T{ timestamp { year 2019 } { month 12 } { day 31 } }
-} [ 2019 365 year-ordinal>timestamp >gmt midnight ] unit-test
+} [ 2019 365 year-ordinal>timestamp ] unit-test
 
 {
     T{ timestamp { year 2020 } { month 12 } { day 31 } }
-} [ 2020 366 year-ordinal>timestamp >gmt midnight ] unit-test
+} [ 2020 366 year-ordinal>timestamp ] unit-test
 
 { t } [
     2020 <year> timestamp>year-dates-gmt
@@ -287,6 +287,12 @@ IN: calendar
 { 151 } [ 2014 1 10 <date>  2014 8 9 <date>  weekdays-between ] unit-test
 { 151 } [ 2014 1 10 <date>  2014 8 10 <date>  weekdays-between ] unit-test
 
+{ t } [ 2014 1 10 <date> weekday? ] unit-test
+{ f } [ 2014 1 10 <date> weekend? ] unit-test
+
+{ t } [ 2014 1 11 <date> weekend? ] unit-test
+{ f } [ 2014 1 11 <date> weekday? ] unit-test
+
 
 { t } [
     2014 1 1 <date-gmt>
@@ -314,18 +320,6 @@ IN: calendar
     dup 1 tail swap v- [ 1 <= ] all?
 ] unit-test
 
-{ 0 } [
-    2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates-gmt
-    [ weekdays-between2 ] with map
-
-    2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates-gmt
-    [ weekdays-between ] with map
-
-    v- sum
-] unit-test
-
 {
     {
         T{ timestamp { year 2020 } { month 3 } { day 1 } }
@@ -437,3 +431,34 @@ IN: calendar
     2000 1 1 <date> 4 >>hour
     2000 1 1 <date> same-day?
 ] unit-test
+
+{
+    T{ timestamp { year 2023 } { month 4 } { day 9 } }
+    T{ timestamp
+        { year 2023 }
+        { month 4 }
+        { day 15 }
+        { hour 23 }
+        { minute 59 }
+        { second 59+999/1000 }
+    }
+} [ 2023 4 13 <date-gmt> start-of-week dup end-of-week ] unit-test
+
+{
+    T{ timestamp
+        { year 2024 }
+        { month 2 }
+        { day 15 }
+        { hour 7 }
+    }
+} [ 2024 02 15 <date-gmt> 48.87 2.67 sunrise >gmt ] unit-test
+
+{
+    T{ timestamp
+        { year 2024 }
+        { month 2 }
+        { day 15 }
+        { hour 17 }
+        { minute 7 }
+    }
+} [ 2024 02 15 <date-gmt> 48.87 2.67 sunset >gmt ] unit-test