]> gitweb.factorcode.org Git - factor.git/commitdiff
calendar: Fix unit test for holidays.
authorDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Nov 2020 19:28:38 +0000 (13:28 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sat, 7 Nov 2020 19:28:38 +0000 (13:28 -0600)
basis/calendar/calendar-tests.factor
basis/calendar/calendar.factor
extra/calendar/holidays/us/us-tests.factor

index 414f500c130301ecf6dc46cc95836d0ea1769eb7..02555a057e6cae2a6de846443599ab3221000aee 100644 (file)
@@ -286,20 +286,20 @@ IN: calendar
 } [ 2020 366 year-ordinal>timestamp >gmt midnight ] unit-test
 
 { t } [
-    2020 <year> timestamp>year-dates
+    2020 <year> timestamp>year-dates-gmt
     [ >date< ymd>ordinal ] map [ < ] monotonic?
 ] unit-test
 
 { t } [
     1999 2025 [a,b] [
-        <year> timestamp>year-dates
+        <year> timestamp>year-dates-gmt
         [ >date< ymd>ordinal ] map [ < ] monotonic?
     ] map [ ] all?
 ] unit-test
 
 { t } [
     1999 2025 [a,b] [
-        <year-gmt> timestamp>year-dates
+        <year-gmt> timestamp>year-dates-gmt
         [ >date< ymd>ordinal ] map [ < ] monotonic?
     ] map [ ] all?
 ] unit-test
@@ -330,37 +330,37 @@ IN: calendar
 
 { t } [
     2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates
+    2014 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between ] with map [ <= ] monotonic?
 ] unit-test
 
 { t } [
     2020 1 1 <date-gmt>
-    2020 <year-gmt> timestamp>year-dates
+    2020 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between ] with map [ <= ] monotonic?
 ] unit-test
 
 { t } [
     2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates
+    2014 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between ] with map
     dup 1 tail swap v- [ 1 <= ] all?
 ] unit-test
 
 { t } [
     2020 1 1 <date-gmt>
-    2020 <year-gmt> timestamp>year-dates
+    2020 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between ] with map
     dup 1 tail swap v- [ 1 <= ] all?
 ] unit-test
 
 { 0 } [
     2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates
+    2014 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between2 ] with map
 
     2014 1 1 <date-gmt>
-    2014 <year-gmt> timestamp>year-dates
+    2014 <year-gmt> timestamp>year-dates-gmt
     [ weekdays-between ] with map
 
     v- sum
index c296758648604e4a002ea4c7d923593984810de2..da666f14bac0fc70b1ef8ce409d86313f02f34bc 100644 (file)
@@ -884,11 +884,11 @@ CONSTANT: weekday-offsets { 0 0 1 2 3 4 5 }
     [ ] tri* + + >integer
     swap 367 366 ? mod ;
 
-: timestamp>year-dates ( timestamp -- seq )
+: timestamp>year-dates-gmt ( timestamp -- seq )
     [ start-of-year >date< julian-day-number ]
     [ days-in-year ] bi
     [ drop ] [ + ] 2bi
-    [a..b) [ julian-day-number>date <date> ] map ;
+    [a..b) [ julian-day-number>date <date-gmt> ] map ;
 
 : year-ordinal>timestamp ( year ordinal -- timestamp )
     [ 1 1 julian-day-number ] dip
index 69273ef0371704a16083f0ff076b25994962969f..4b4a8cb9d5d9ee9519551c2b1abc0ed1a0e565f3 100644 (file)
@@ -11,63 +11,53 @@ sequences tools.test ;
             { year 2020 }
             { month 1 }
             { day 1 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 1 }
             { day 20 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 2 }
             { day 17 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 5 }
             { day 25 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 7 }
             { day 3 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 9 }
             { day 7 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 10 }
             { day 12 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 11 }
             { day 11 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 11 }
             { day 26 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
         T{ timestamp
             { year 2020 }
             { month 12 }
             { day 25 }
-            { gmt-offset T{ duration { hour -6 } } }
         }
     }
 } [
-    2020 <year> timestamp>year-dates [ us-federal holiday? ] filter
+    2020 <year-gmt> timestamp>year-dates-gmt [ us-federal holiday? ] filter
 ] unit-test
\ No newline at end of file