RegressionTests__TimeAndDateTest.st
changeset 736 b51ba7f6c03f
parent 633 69e6e55c38e2
child 737 06d8d2821c46
--- a/RegressionTests__TimeAndDateTest.st	Fri Nov 02 11:37:40 2012 +0100
+++ b/RegressionTests__TimeAndDateTest.st	Mon Nov 05 14:30:04 2012 +0100
@@ -65,6 +65,28 @@
                     onError:[self error]
                   ) = (Date newDay:2 month:5 year:2010).
 
+    {
+        {   '3-jan-2012'   .   (Date newDay:3 month:1 year:2012)    } .
+        {   '15-feb-2012'   .   (Date newDay:15 month:2 year:2012)  } .
+        {   '06-mar-2011'   .   (Date newDay:6 month:3 year:2011)   } .
+        {   '19-apr-2013'   .   (Date newDay:19 month:4 year:2013)  } .
+        {   '21-may-2015'   .   (Date newDay:21 month:5 year:2015)  } .
+        {   '21-jun-2015'   .   (Date newDay:21 month:6 year:2015)  } .
+        {   '21-jul-2015'   .   (Date newDay:21 month:7 year:2015)  } .
+        {   '21-aug-2015'   .   (Date newDay:21 month:8 year:2015)  } .
+        {   '21-sep-2015'   .   (Date newDay:21 month:9 year:2015)  } .
+        {   '21-oct-2015'   .   (Date newDay:21 month:10 year:2015)  } .
+        {   '21-nov-2015'   .   (Date newDay:21 month:11 year:2015)  } .
+        {   '21-dec-2015'   .   (Date newDay:21 month:12 year:2015)  } .
+    } do:[:eachTestPair |
+         self assert:(Date 
+                        readFrom:(eachTestPair first)
+                        printFormat:'%d-%shortMonthName-%y' 
+                        language:'en' 
+                        onError:[self error]
+                      ) = (eachTestPair second).
+    ].
+
      self assert:(Date 
                     readFrom:'2-may-2010'
                     printFormat:'%d-%monthName-%y' 
@@ -107,6 +129,18 @@
     "
      self new test_02_ReadingDates
     "
+!
+
+test_03_calenderWeek
+    self assert:(Date newDay:5 month:11 year:2012) weekInYear == 45.
+    self assert:(Date newDay:11 month:11 year:2012) weekInYear == 45.
+
+    self assert:(Date newDay:4 month:11 year:2012) weekInYear == 44.
+    self assert:(Date newDay:12 month:11 year:2012) weekInYear == 46.
+
+    "
+     self new test_03_calenderWeek
+    "
 ! !
 
 !TimeAndDateTest class methodsFor:'documentation'!