The Inbox: KernelTests-cbc.291.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: KernelTests-cbc.291.mcz

commits-2
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-cbc.291.mcz

==================== Summary ====================

Name: KernelTests-cbc.291
Author: cbc
Time: 6 March 2015, 3:52:01.005 pm
UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
Ancestors: KernelTests-ul.290, KernelTests-cbc.278

Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.
Test convering adding various durations (like above) as well as adding strings, numbers, Timespans, Times, and DateAndTimes.
Also tests subtracting the same.

Added DurationArithmeticTest - tests expected outcomes of adding durations together, including the generic ones (resulting in GenericDuration instances).
Also, tested for certain tricky leapYear conditions when adding years.

=============== Diff against KernelTests-ul.290 ===============

Item was added:
+ TestCase subclass: #DateAndTimeArithmeticTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Chronology'!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddDateAndTime1 (in category 'testing') -----
+ testAddDateAndTime1
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + (DateAndTime year: 2014 month: 3 day: 31)) = (DateAndTime year: 2014 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddDateAndTime2 (in category 'testing') -----
+ testAddDateAndTime2
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) + (DateAndTime year: 2014 month: 1 day: 31)) = (DateAndTime year: 2014 month: 3 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddDays (in category 'testing') -----
+ testAddDays
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 days) = (DateAndTime year: 2014 month: 2 day: 2)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddHours (in category 'testing') -----
+ testAddHours
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 hours) = (DateAndTime year: 2014 month: 1 day: 31 hour: 2 minute: 0)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddIntegers (in category 'testing') -----
+ testAddIntegers
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2) = (DateAndTime year: 2014 month: 1 day: 31 hour: 0 minute: 0 second: 0 nanoSecond: 000000002 offset: DateAndTime localOffset)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMinutes (in category 'testing') -----
+ testAddMinutes
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 minutes) = (DateAndTime year: 2014 month: 1 day: 31 hour: 0 minute: 2)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonthTimespan1 (in category 'testing') -----
+ testAddMonthTimespan1
+ self assert: ((DateAndTime year: 2014 month: 1 day: 1) + (Month month: 1 year: 2015)
+ = (DateAndTime year: 2014 month: 2 day: 1)).
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonthTimespan2 (in category 'testing') -----
+ testAddMonthTimespan2
+ self assert: ((DateAndTime year: 2014 month: 1 day: 1) + (Month month: 2 year: 2004)
+ = (DateAndTime year: 2014 month: 1 day: 30)).
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonthTimespan3 (in category 'testing') -----
+ testAddMonthTimespan3
+ self assert: ((DateAndTime year: 2014 month: 1 day: 1) + (Month month: 2 year: 2005)
+ = (DateAndTime year: 2014 month: 1 day: 29)).
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonths1 (in category 'testing') -----
+ testAddMonths1
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 1 month) = (DateAndTime year: 2014 month: 2 day: 28)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonths2 (in category 'testing') -----
+ testAddMonths2
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 months) = (DateAndTime year: 2014 month: 3 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddMonths4 (in category 'testing') -----
+ testAddMonths4
+ self assert: ((DateAndTime year: 2004 month: 1 day: 31) + 1 month) = (DateAndTime year: 2004 month: 2 day: 29)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddNanoSeconds (in category 'testing') -----
+ testAddNanoSeconds
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 nanoSeconds) = (DateAndTime year: 2014 month: 1 day: 31 hour: 0 minute: 0 second: 0 nanoSecond: 000000002 offset: DateAndTime localOffset)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddSeconds (in category 'testing') -----
+ testAddSeconds
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 seconds) = (DateAndTime year: 2014 month: 1 day: 31 hour: 0 minute: 0 second: 2)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddStrings (in category 'testing') -----
+ testAddStrings
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + '02:00:00:00') = (DateAndTime year: 2014 month: 2 day: 2)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddTime (in category 'testing') -----
+ testAddTime
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + ('02:00:00' asTime)) = (DateAndTime year: 2014 month: 1 day: 31 hour: 2 minute: 0)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddTimespan (in category 'testing') -----
+ testAddTimespan
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31)
+ + ((DateAndTime year: 2014 month: 1 day: 1) to: (DateAndTime year: 2014 month: 1 day: 3))) = (DateAndTime year: 2014 month: 2 day: 2)
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddWeeks (in category 'testing') -----
+ testAddWeeks
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) + 2 weeks) = (DateAndTime year: 2014 month: 2 day: 14)
+
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears1 (in category 'testing') -----
+ testAddYears1
+ self assert: ((DateAndTime year: 2006 month: 1 day: 31) + 2 years) = (DateAndTime year: 2008 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears2 (in category 'testing') -----
+ testAddYears2
+ self assert: ((DateAndTime year: 2007 month: 1 day: 31) + 2 years) = (DateAndTime year: 2009 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears3 (in category 'testing') -----
+ testAddYears3
+ self assert: ((DateAndTime year: 2004 month: 2 day: 29) + 1 year) = (DateAndTime year: 2005 month: 2 day: 28)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears4 (in category 'testing') -----
+ testAddYears4
+ self assert: ((DateAndTime year: 2003 month: 4 day: 1) + 2 years) = (DateAndTime year: 2005 month: 4 day: 1)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears5 (in category 'testing') -----
+ testAddYears5
+ self assert: ((DateAndTime year: 2003 month: 4 day: 1) + 1 years) = (DateAndTime year: 2004 month: 4 day: 1)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testAddYears6 (in category 'testing') -----
+ testAddYears6
+ self assert: ((DateAndTime year: 2011 month: 3 day: 1) + 1 years) = (DateAndTime year: 2012 month: 3 day: 1)
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractDateAndTime1 (in category 'testing') -----
+ testSubtractDateAndTime1
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - (DateAndTime year: 2014 month: 1 day: 31)) = 59 days!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractDateAndTime2 (in category 'testing') -----
+ testSubtractDateAndTime2
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) - (DateAndTime year: 2014 month: 3 day: 31)) = 59 days negated!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractDays (in category 'testing') -----
+ testSubtractDays
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 days) = (DateAndTime year: 2014 month: 3 day: 29)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractHours (in category 'testing') -----
+ testSubtractHours
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 hours) = (DateAndTime year: 2014 month: 3 day: 30 hour: 22 minute: 0)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractIntegers (in category 'testing') -----
+ testSubtractIntegers
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2) = (DateAndTime year: 2014 month: 3 day: 30 hour: 23 minute: 59 second: 59 nanoSecond: 999999998 offset: DateAndTime localOffset)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractMinutes (in category 'testing') -----
+ testSubtractMinutes
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 minutes) = (DateAndTime year: 2014 month: 3 day: 30 hour: 23 minute: 58)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractMonths1 (in category 'testing') -----
+ testSubtractMonths1
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 1 month) = (DateAndTime year: 2014 month: 2 day: 28)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractMonths2 (in category 'testing') -----
+ testSubtractMonths2
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 months) = (DateAndTime year: 2014 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractMonths3 (in category 'testing') -----
+ testSubtractMonths3
+ self assert: ((DateAndTime year: 2014 month: 3 day: 14) - 1 month) = (DateAndTime year: 2014 month: 2 day: 14)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractMonths4 (in category 'testing') -----
+ testSubtractMonths4
+ self assert: ((DateAndTime year: 2004 month: 3 day: 31) - 1 month) = (DateAndTime year: 2004 month: 2 day: 29)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractNanoSeconds (in category 'testing') -----
+ testSubtractNanoSeconds
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 nanoSeconds) = (DateAndTime year: 2014 month: 3 day: 30 hour: 23 minute: 59 second: 59 nanoSecond: 999999998 offset: DateAndTime localOffset)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractSeconds (in category 'testing') -----
+ testSubtractSeconds
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 seconds) = (DateAndTime year: 2014 month: 3 day: 30 hour: 23 minute: 59 second: 58)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractStrings (in category 'testing') -----
+ testSubtractStrings
+ self assert: ((DateAndTime year: 2014 month: 1 day: 31) - '02:00:00:00') = (DateAndTime year: 2014 month: 1 day: 29)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractTime (in category 'testing') -----
+ testSubtractTime
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - ('02:00:00' asTime)) = (DateAndTime year: 2014 month: 3 day: 30 hour: 22 minute: 0)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractTimespan (in category 'testing') -----
+ testSubtractTimespan
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31)
+ - ((DateAndTime year: 2014 month: 3 day: 1) to: (DateAndTime year: 2024 month: 1 day: 3)))   = ('30:00:00:00' asDuration)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractWeeks (in category 'testing') -----
+ testSubtractWeeks
+ self assert: ((DateAndTime year: 2014 month: 3 day: 31) - 2 weeks) = (DateAndTime year: 2014 month: 3 day: 17)
+
+ !

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears1 (in category 'testing') -----
+ testSubtractYears1
+ self assert: ((DateAndTime year: 2008 month: 1 day: 31) - 2 years) = (DateAndTime year: 2006 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears2 (in category 'testing') -----
+ testSubtractYears2
+ self assert: ((DateAndTime year: 2009 month: 1 day: 31) - 2 years) = (DateAndTime year: 2007 month: 1 day: 31)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears3 (in category 'testing') -----
+ testSubtractYears3
+ self assert: ((DateAndTime year: 2005 month: 2 day: 28) - 1 year) = (DateAndTime year: 2004 month: 2 day: 28)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears4 (in category 'testing') -----
+ testSubtractYears4
+ self assert: ((DateAndTime year: 2005 month: 4 day: 1) - 2 years) = (DateAndTime year: 2003 month: 4 day: 1)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears5 (in category 'testing') -----
+ testSubtractYears5
+ self assert: ((DateAndTime year: 2004 month: 4 day: 1) - 1 years) = (DateAndTime year: 2003 month: 4 day: 1)!

Item was added:
+ ----- Method: DateAndTimeArithmeticTest>>testSubtractYears6 (in category 'testing') -----
+ testSubtractYears6
+ self assert: ((DateAndTime year: 2011 month: 3 day: 1) - 1 years) = (DateAndTime year: 2010 month: 3 day: 1)!

Item was added:
+ TestCase subclass: #DurationArithmeticTest
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'KernelTests-Chronology'!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddDayDurations (in category 'as yet unclassified') -----
+ testAddDayDurations
+ self assert: (1 day + 2 days = 3 days)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddDayHourDurations (in category 'as yet unclassified') -----
+ testAddDayHourDurations
+ self assert: (1 day + 2 hours = '1:02:00:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddDayMonthDurations (in category 'as yet unclassified') -----
+ testAddDayMonthDurations
+ self assert: (1 day + 2 months = (GenericDuration new + 1 day + 2 months))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddHourDayDurations (in category 'as yet unclassified') -----
+ testAddHourDayDurations
+ self assert: (1 hour + 2 days = '2:01:00:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddHourMinuteDurations (in category 'as yet unclassified') -----
+ testAddHourMinuteDurations
+ self assert: (1 hour + 2 minutes = '0:01:02:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddMinuteHourDurations (in category 'as yet unclassified') -----
+ testAddMinuteHourDurations
+ self assert: (1 minute + 2 hours = '0:02:01:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddMinuteSecondDurations (in category 'as yet unclassified') -----
+ testAddMinuteSecondDurations
+ self assert: (1 minute + 2 seconds = '0:00:01:02' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddMonthDayDurations (in category 'as yet unclassified') -----
+ testAddMonthDayDurations
+ self assert: (1 month + 2 days = (GenericDuration new + 1 month + 2 days))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddMonthYearDurations (in category 'as yet unclassified') -----
+ testAddMonthYearDurations
+ self assert: (1 month + 2 years = (GenericDuration new + 1 month + 2 years))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddNanoSecondSecondDurations (in category 'as yet unclassified') -----
+ testAddNanoSecondSecondDurations
+ self assert: (1 nanoSeconds + 2 seconds = '0:00:00:02.000000001' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddSecondMinuteDurations (in category 'as yet unclassified') -----
+ testAddSecondMinuteDurations
+ self assert: (1 second + 2 minutes = '0:00:02:01' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddSecondNanoSecondDurations (in category 'as yet unclassified') -----
+ testAddSecondNanoSecondDurations
+ self assert: (1 second + 2 nanoSeconds = '0:00:00:01.000000002' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testAddYearMonthDurations (in category 'as yet unclassified') -----
+ testAddYearMonthDurations
+ self assert: (1 year + 2 months = (GenericDuration new + 1 year + 2 months))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testDayDurationAssociativeSubtractionWithDateTime (in category 'as yet unclassified') -----
+ testDayDurationAssociativeSubtractionWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) - 1 hour - 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) - (1 hour + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testDayDurationAssociativeWithDateTime (in category 'as yet unclassified') -----
+ testDayDurationAssociativeWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) + 1 hour + 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) + (1 hour + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testGenericDurationAddition (in category 'as yet unclassified') -----
+ testGenericDurationAddition
+ self assert: (((1 month + 1 month) + (1 year + 1 year))
+ = (1 month + 1 month + 1 year + 1 year))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testGenericDurationSubtraction (in category 'as yet unclassified') -----
+ testGenericDurationSubtraction
+ self assert: (((1 month + 1 month) - (1 year + 1 year))
+ = (1 month + 1 month - 1 year - 1 year))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testMonthDurationAssociativeSubtractionWithDateTime (in category 'as yet unclassified') -----
+ testMonthDurationAssociativeSubtractionWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) - 1 month - 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) - (1 month + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testMonthDurationAssociativeWithDateTime (in category 'as yet unclassified') -----
+ testMonthDurationAssociativeWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) + 1 month + 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) + (1 month + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testMonthDurationNotCommutative (in category 'as yet unclassified') -----
+ testMonthDurationNotCommutative
+ self deny: ((1 month + 2 days) = (2 days + 1 month))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractDayDurations (in category 'as yet unclassified') -----
+ testSubtractDayDurations
+ self assert: (2 days - 1 day = 1 day)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractDayHourDurations (in category 'as yet unclassified') -----
+ testSubtractDayHourDurations
+ self assert: (1 day - 2 hours = '0:22:00:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractDayMonthDurations (in category 'as yet unclassified') -----
+ testSubtractDayMonthDurations
+ self assert: (1 day - 2 months = (GenericDuration new + 1 day - 2 months))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractHourDayDurations (in category 'as yet unclassified') -----
+ testSubtractHourDayDurations
+ self assert: (1 hour - 2 days = '-1:23:00:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractHourMinuteDurations (in category 'as yet unclassified') -----
+ testSubtractHourMinuteDurations
+ self assert: (1 hour - 2 minutes = '0:00:58:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractMinuteHourDurations (in category 'as yet unclassified') -----
+ testSubtractMinuteHourDurations
+ self assert: (1 minute - 2 hours = '-0:01:59:00' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractMinuteSecondDurations (in category 'as yet unclassified') -----
+ testSubtractMinuteSecondDurations
+ self assert: (1 minute - 2 seconds = '0:00:00:58' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractMonthDayDurations (in category 'as yet unclassified') -----
+ testSubtractMonthDayDurations
+ self assert: (1 month - 2 days = (GenericDuration new + 1 month - 2 days))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractMonthYearDurations (in category 'as yet unclassified') -----
+ testSubtractMonthYearDurations
+ self assert: (1 month - 2 years = (GenericDuration new + 1 month - 2 years))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractNanoSecondSecondDurations (in category 'as yet unclassified') -----
+ testSubtractNanoSecondSecondDurations
+ self assert: (1 nanoSeconds - 2 seconds = '-0:00:00:01.999999999' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractSecondMinuteDurations (in category 'as yet unclassified') -----
+ testSubtractSecondMinuteDurations
+ self assert: (1 second - 2 minutes = '-0:00:01:59' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractSecondNanoSecondDurations (in category 'as yet unclassified') -----
+ testSubtractSecondNanoSecondDurations
+ self assert: (1 second - 2 nanoSeconds = '0:00:00:00.999999998' asDuration)!

Item was added:
+ ----- Method: DurationArithmeticTest>>testSubtractYearMonthDurations (in category 'as yet unclassified') -----
+ testSubtractYearMonthDurations
+ self assert: (1 year - 2 months = (GenericDuration new + 1 year - 2 months))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testYearDurationAssociativeSubtractionWithDateTime (in category 'as yet unclassified') -----
+ testYearDurationAssociativeSubtractionWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) - 1 year - 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) - (1 year + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testYearDurationAssociativeWithDateTime (in category 'as yet unclassified') -----
+ testYearDurationAssociativeWithDateTime
+ self assert: (((DateAndTime year: 2014 month: 1 day: 31) + 1 year + 1 day)
+ = ((DateAndTime year: 2014 month: 1 day: 31) + (1 year + 1 day)))!

Item was added:
+ ----- Method: DurationArithmeticTest>>testYearDurationNotCommutative (in category 'as yet unclassified') -----
+ testYearDurationNotCommutative
+ self deny: ((1 year + 2 days) = (2 days + 1 year))!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-cbc.291.mcz

David T. Lewis
On Fri, Mar 06, 2015 at 11:52:04PM +0000, [hidden email] wrote:

> A new version of KernelTests was added to project The Inbox:
> http://source.squeak.org/inbox/KernelTests-cbc.291.mcz
>
> ==================== Summary ====================
>
> Name: KernelTests-cbc.291
> Author: cbc
> Time: 6 March 2015, 3:52:01.005 pm
> UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
> Ancestors: KernelTests-ul.290, KernelTests-cbc.278
>
> Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.

This would be a good time to check our tests. In my locale, the springtime
daylight savings time change is going to happen this weekend. If I evaluate
"DateAndTime now + 3 days" what is the expected result?

Dave


cbc
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-cbc.291.mcz

cbc
It should be three days from now, same hour of the day I think.  That was not part of the tests, though. Something to add.

This change is part of a set ( including new kernel and be collection packages ). Adding days though was not changed.

Sent from my iPhone

> On Mar 6, 2015, at 5:00 PM, David T. Lewis <[hidden email]> wrote:
>
>> On Fri, Mar 06, 2015 at 11:52:04PM +0000, [hidden email] wrote:
>> A new version of KernelTests was added to project The Inbox:
>> http://source.squeak.org/inbox/KernelTests-cbc.291.mcz
>>
>> ==================== Summary ====================
>>
>> Name: KernelTests-cbc.291
>> Author: cbc
>> Time: 6 March 2015, 3:52:01.005 pm
>> UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
>> Ancestors: KernelTests-ul.290, KernelTests-cbc.278
>>
>> Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.
>
> This would be a good time to check our tests. In my locale, the springtime
> daylight savings time change is going to happen this weekend. If I evaluate
> "DateAndTime now + 3 days" what is the expected result?
>
> Dave
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-cbc.291.mcz

David T. Lewis
On Fri, Mar 06, 2015 at 09:10:13PM -0800, Chris wrote:

>
> > On Mar 6, 2015, at 5:00 PM, David T. Lewis <[hidden email]> wrote:
> >
> >> On Fri, Mar 06, 2015 at 11:52:04PM +0000, [hidden email] wrote:
> >> A new version of KernelTests was added to project The Inbox:
> >> http://source.squeak.org/inbox/KernelTests-cbc.291.mcz
> >>
> >> ==================== Summary ====================
> >>
> >> Name: KernelTests-cbc.291
> >> Author: cbc
> >> Time: 6 March 2015, 3:52:01.005 pm
> >> UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
> >> Ancestors: KernelTests-ul.290, KernelTests-cbc.278
> >>
> >> Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.
> >
> > This would be a good time to check our tests. In my locale, the springtime
> > daylight savings time change is going to happen this weekend. If I evaluate
> > "DateAndTime now + 3 days" what is the expected result?
>
> It should be three days from now, same hour of the day I think.  That was not part of the tests, though. Something to add.
>
> This change is part of a set ( including new kernel and be collection packages ). Adding days though was not changed.
>

Hi Chris,

My comment was not meant as a criticism of your changes, it is more a
general observation about our murky definitions of time in Squeak.

If "3 days" means a duration of 259200 seconds, and if the time in my
(Detroit) time zone right now is 2015-03-07T18:00:00-05:00 (6:00 pm),
then the DateAndTime that I should see three days from now is
2015-03-10T19:00:00-04:00 (7:00 pm, 259200 seconds from now).

On the other hand, if "3 days" means three calendar days (as I think that
you are expecting it to mean), then the DateAndTime three days from now
would be 2015-03-10T18:00:00-04:00 (still 6:00 pm on the wall clock, but
actually an hour earlier in terms of elapsed time).

These are two different points in time, separated by 3600 seconds of
actual duration.

So conceptually, we need to agree if "3 days" is a duration, or if it is
a count of days on the calendar. The current implementation of "3 days"
in Squeak implies that we mean it to be a duration (259200 seconds). If
that is the case, then thinking of "3 days" as an count of calendar days
is not the same thing at all, and the question "what DateAndTime will it
be be 3 days from now" is ambiguous when a daylight savings transition
is involved.

The daylight savings time transition illustrates the problem nicely, but
IMO the real issue is lack of clear definitions of what we mean by words
like "day" and "month" and "year". In everyday spoken language, it is OK
for those words to have different meanings in different contexts. But
even Squeak is not smart enough to resolve those ambiguities without a
little help from us :)

Dave


cbc
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-cbc.291.mcz

cbc
Hi Dave. No offense taken (in either chain).  I think I've made my position clear - calendar based intervals. Otherwise 1 year would be 365 days (or worse 365.25 days).  So 2 days from now is actually only 47 hours off not 48.

If you want  3 intervals of 24 hours I'd propose using 3 * 24 hours instead.

Yes my answer doesn't solve every thing. But it is useful in certain areas - common areas. It does need better documentation though.

-cbc

Sent from my iPhone

> On Mar 7, 2015, at 4:14 PM, David T. Lewis <[hidden email]> wrote:
>
>> On Fri, Mar 06, 2015 at 09:10:13PM -0800, Chris wrote:
>>
>>>> On Mar 6, 2015, at 5:00 PM, David T. Lewis <[hidden email]> wrote:
>>>>
>>>> On Fri, Mar 06, 2015 at 11:52:04PM +0000, [hidden email] wrote:
>>>> A new version of KernelTests was added to project The Inbox:
>>>> http://source.squeak.org/inbox/KernelTests-cbc.291.mcz
>>>>
>>>> ==================== Summary ====================
>>>>
>>>> Name: KernelTests-cbc.291
>>>> Author: cbc
>>>> Time: 6 March 2015, 3:52:01.005 pm
>>>> UUID: 54afce93-39e9-4c4a-92a4-ecbe32540c69
>>>> Ancestors: KernelTests-ul.290, KernelTests-cbc.278
>>>>
>>>> Added DateAndTimeArithmeticTest - to test adding things to DateAndTime instances.  This includes things like: DateAndTime now + 3 days.
>>>
>>> This would be a good time to check our tests. In my locale, the springtime
>>> daylight savings time change is going to happen this weekend. If I evaluate
>>> "DateAndTime now + 3 days" what is the expected result?
>>
>> It should be three days from now, same hour of the day I think.  That was not part of the tests, though. Something to add.
>>
>> This change is part of a set ( including new kernel and be collection packages ). Adding days though was not changed.
>>
>
> Hi Chris,
>
> My comment was not meant as a criticism of your changes, it is more a
> general observation about our murky definitions of time in Squeak.
>
> If "3 days" means a duration of 259200 seconds, and if the time in my
> (Detroit) time zone right now is 2015-03-07T18:00:00-05:00 (6:00 pm),
> then the DateAndTime that I should see three days from now is
> 2015-03-10T19:00:00-04:00 (7:00 pm, 259200 seconds from now).
>
> On the other hand, if "3 days" means three calendar days (as I think that
> you are expecting it to mean), then the DateAndTime three days from now
> would be 2015-03-10T18:00:00-04:00 (still 6:00 pm on the wall clock, but
> actually an hour earlier in terms of elapsed time).
>
> These are two different points in time, separated by 3600 seconds of
> actual duration.
>
> So conceptually, we need to agree if "3 days" is a duration, or if it is
> a count of days on the calendar. The current implementation of "3 days"
> in Squeak implies that we mean it to be a duration (259200 seconds). If
> that is the case, then thinking of "3 days" as an count of calendar days
> is not the same thing at all, and the question "what DateAndTime will it
> be be 3 days from now" is ambiguous when a daylight savings transition
> is involved.
>
> The daylight savings time transition illustrates the problem nicely, but
> IMO the real issue is lack of clear definitions of what we mean by words
> like "day" and "month" and "year". In everyday spoken language, it is OK
> for those words to have different meanings in different contexts. But
> even Squeak is not smart enough to resolve those ambiguities without a
> little help from us :)
>
> Dave
>
>