[squeak-dev] The Inbox: Chronology-Tests-ct.31.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jul 14 14:14:55 UTC 2022


A new version of Chronology-Tests was added to project The Inbox:
http://source.squeak.org/inbox/Chronology-Tests-ct.31.mcz

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

Name: Chronology-Tests-ct.31
Author: ct
Time: 10 June 2022, 7:14:53.837345 pm
UUID: 989ff157-f700-a04f-9051-8ba05c932351
Ancestors: Chronology-Tests-ct.30

Adds test for #busyWait with duration shorter than 1 milliSecond. Regression test for Chronology-Core-ct.80.

=============== Diff against Chronology-Tests-ct.30 ===============

Item was removed:
- SystemOrganization addCategory: #'Chronology-Tests'!

Item was removed:
- TestCase subclass: #DateAndTimeEpochTest
- 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !DateAndTimeEpochTest commentStamp: 'tlk 1/6/2004 18:27' prior: 0!
- I represent one of several Sunit test Cases intentended to provide complete coverage  for the Chronology set of classes as part of the external testing. The other Chronology sunit test cases are:
-  DateTestCase
-  DateAndTimeLeapTestCase,
-  DurationTestCase,
-  ScheduleTestCase
-  TimeStampTestCase
-  TimespanDoTestCase, 
-  TimespanDoSpanAYearTestCase, 
-  TimespanTestCase, 
-  YearMonthWeekTestCase.  
- These tests attempt to exercise all public and private methods.  Except, they do not explicitly depreciated methods. tlk
- My fixtures are:
- aDateAndTime = January 01, 1901 midnight (the start of the Squeak epoch) with localTimeZone = Grenwhich Meridian (local offset = 0 hours)
- aDuration = 1 day, 2 hours, 3, minutes, 4 seconds and 5 nano seconds.
- aTimeZone =  'Epoch Test Time Zone', 'ETZ' , offset: 12 hours, 15 minutes. !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>setUp (in category 'running') -----
- setUp
- 	localTimeZoneToRestore := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	aDateAndTime :=  DateAndTime localTimeZone: TimeZone default; epoch.
- 	aTimeZone := TimeZone offset: (Duration minutes: 135) name: 'Epoch Test Time Zone' abbreviation: 'ETZ'.
- 	aDuration := Duration days: 1 hours: 2 minutes: 3 seconds: 4 nanoSeconds: 5 !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>tearDown (in category 'running') -----
- tearDown
- 	DateAndTime localTimeZone: localTimeZoneToRestore.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-      "wish I could remove the time zones I added earlier, tut there is no method for that"
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsDate (in category 'tests') -----
- testAsDate
- 	self assert: aDateAndTime asDate =   'January 1, 1901' asDate.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsDateAndTime (in category 'tests') -----
- testAsDateAndTime
- 	self assert: aDateAndTime asDateAndTime =  aDateAndTime
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsDuration (in category 'tests') -----
- testAsDuration
- 	self assert: aDateAndTime asDuration =  0 asDuration
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsLocal (in category 'tests') -----
- testAsLocal
- 	self assert: aDateAndTime asLocal =  aDateAndTime.
- 	self assert: aDateAndTime asLocal = (aDateAndTime utcOffset: aDateAndTime class localOffset)
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsMonth (in category 'tests') -----
- testAsMonth
- 	self assert: aDateAndTime asMonth = (Month month: 'January' year: 1901). 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsNanoSeconds (in category 'tests') -----
- testAsNanoSeconds
- 	self assert: aDateAndTime asNanoSeconds =  0 asDuration asNanoSeconds
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsSeconds (in category 'tests') -----
- testAsSeconds
- 	self assert: aDateAndTime asSeconds =  0 asDuration asSeconds
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsTime (in category 'tests') -----
- testAsTime
- 	self assert: aDateAndTime asTime =  Time midnight.
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsTimeStamp (in category 'tests') -----
- testAsTimeStamp
- 	self assert: aDateAndTime asTimeStamp =  TimeStamp new.
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsUTC (in category 'tests') -----
- testAsUTC
- 	self assert: aDateAndTime asUTC =  aDateAndTime
-           !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsWeek (in category 'tests') -----
- testAsWeek
- 	self assert: aDateAndTime asWeek = (Week starting: '12-31-1900' asDate). 
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testAsYear (in category 'tests') -----
- testAsYear
- 	self assert: aDateAndTime asYear =   (Year starting: '01-01-1901' asDate). 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testCurrent (in category 'tests') -----
- testCurrent
- 	self deny: aDateAndTime =  (DateAndTime current).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDateTime (in category 'tests') -----
- testDateTime
- 	self assert: aDateAndTime =  (DateAndTime date: '01-01-1901' asDate time: '00:00:00' asTime)
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDay (in category 'tests') -----
- testDay
- 	self assert: aDateAndTime day =   DateAndTime new day
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDayMonthYearDo (in category 'tests') -----
- testDayMonthYearDo
- 	|iterations|
- 	iterations := 0.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  iterations := iterations + 1])  = 1.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachYear])  = 1901.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachMonth]) = 1.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachDay]) = 1.
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDayOfMonth (in category 'tests') -----
- testDayOfMonth
- 	self assert: aDateAndTime dayOfMonth  = 1.
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDayOfWeek (in category 'tests') -----
- testDayOfWeek
- 	self assert: aDateAndTime dayOfWeek  = 3.
- 	self assert: aDateAndTime dayOfWeekAbbreviation = 'Tue'.
- 	self assert: aDateAndTime dayOfWeekName = 'Tuesday'.
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDayOfYear (in category 'tests') -----
- testDayOfYear
- 	self assert: aDateAndTime dayOfYear  = 1.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDaysInMonth (in category 'tests') -----
- testDaysInMonth
- 	self assert: aDateAndTime daysInMonth  = 31.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDaysInYear (in category 'tests') -----
- testDaysInYear
- 	self assert: aDateAndTime daysInYear  = 365.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDaysLeftInYear (in category 'tests') -----
- testDaysLeftInYear
- 	self assert: aDateAndTime daysLeftInYear  = 364.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testDuration (in category 'tests') -----
- testDuration
- 	self assert: aDateAndTime duration  = 0 asDuration.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testEpoch (in category 'tests - epoch') -----
- testEpoch
- 	self assert: aDateAndTime =  '1901-01-01T00:00:00+00:00' asDateAndTime
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testEpochHappenedOnlyOnce (in category 'tests - epoch') -----
- testEpochHappenedOnlyOnce
- 	"The epoch is defined as January 01, 1901 midnight with localTimeZone = Greenwhich Meridian (local offset = 0 hours)"
- 
- 	| epochInMichigan epochInKyoto |
- 	self assert: aDateAndTime =  '1901-01-01T00:00:00+00:00' asDateAndTime.
- 	self assert: 0 equals: aDateAndTime asSeconds.
- 	epochInMichigan := '1900-12-31T19:00:00-05:00' asDateAndTime.
- 	self assert: 0 equals: epochInMichigan asSeconds.
- 	self assert: aDateAndTime equals: epochInMichigan.
- 	epochInKyoto := '1901-01-01T09:00:00+09:00' asDateAndTime.
- 	self assert: 0 equals: epochInKyoto asSeconds.
- 	self assert: aDateAndTime equals: epochInKyoto.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testFirstDayOfMonth (in category 'tests') -----
- testFirstDayOfMonth
- 	self assert: aDateAndTime firstDayOfMonth =   1
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testFromSeconds (in category 'tests') -----
- testFromSeconds
- 	self assert: aDateAndTime =  (DateAndTime fromSeconds: 0).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testFromString (in category 'tests') -----
- testFromString
- 	self assert: aDateAndTime =  (DateAndTime fromString: ' 1901-01-01T00:00:00+00:00').
- 	self assert: aDateAndTime =  (DateAndTime fromString: ' 1901-01-01T00:00:00').
- 	self assert: aDateAndTime =  (DateAndTime fromString: ' 1901-01-01T00:00').
- 	self assert: aDateAndTime =  (DateAndTime fromString: ' 1901-01-01T00:00:00+00:00').
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testHash (in category 'tests') -----
- testHash
- 	self assert: aDateAndTime hash =    DateAndTime new hash.
- 	self assert: aDateAndTime hash =     -2177452800000000
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testHour (in category 'tests') -----
- testHour
- 	self assert: aDateAndTime hour =    aDateAndTime hour24.
- 	self assert: aDateAndTime hour =    0.
- 	self assert: aDateAndTime hour =    aDateAndTime hours
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testHour12 (in category 'tests') -----
- testHour12
- 	self assert: aDateAndTime hour12  = DateAndTime new hour12.
- 	self assert: aDateAndTime hour12  = 12
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testIsLeapYear (in category 'tests') -----
- testIsLeapYear
- 	self deny: aDateAndTime isLeapYear
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testJulianDayNumber (in category 'tests') -----
- testJulianDayNumber
- 	self assert: aDateAndTime =  (DateAndTime julianDayNumber: 2415386).
- 	self assert: aDateAndTime julianDayNumber = 2415386.!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testLessThan (in category 'tests') -----
- testLessThan
- 	self assert: aDateAndTime  < (aDateAndTime + '1:00:00:00').
- 	self assert: aDateAndTime + -1 < aDateAndTime.
- 	!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMeridianAbbreviation (in category 'tests') -----
- testMeridianAbbreviation
- 	self assert: aDateAndTime meridianAbbreviation = 'AM'.
- 
- 	!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMiddleOf (in category 'tests') -----
- testMiddleOf
- 	self assert: (aDateAndTime middleOf: '2:00:00:00' asDuration) = 
- 	 (Timespan starting: '12-31-1900' asDate duration: 2 days).
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMidnight (in category 'tests') -----
- testMidnight
- 	self assert: aDateAndTime midnight =  aDateAndTime
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMinus (in category 'tests') -----
- testMinus
- 	self assert: aDateAndTime - aDateAndTime =  '0:00:00:00' asDuration.
- 	self assert: aDateAndTime - '0:00:00:00' asDuration = aDateAndTime.
- 	self assert: aDateAndTime - aDuration =  (DateAndTime year: 1900 month: 12 day: 30 hour: 21 minute: 56 second: 55 nanoSecond: 999999995 offset: 0 hours ).
- 	" I believe this Failure is a bug in the nanosecond part of (DateAndTime >> year:month:day:hour:minute:second:nanoSecond:offset:)" !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMinute (in category 'tests') -----
- testMinute
- 	self assert: aDateAndTime minute =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMinutes (in category 'tests') -----
- testMinutes
- 	self assert: aDateAndTime minutes = 0
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testMonth (in category 'tests') -----
- testMonth
- 	self assert: aDateAndTime month  = 1.
- 	self assert: aDateAndTime monthAbbreviation = 'Jan'.
- 	self assert: aDateAndTime monthName = 'January'.
- 	self assert: aDateAndTime monthIndex = 1.!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testNanoSecond (in category 'tests') -----
- testNanoSecond
- 	self assert: aDateAndTime nanoSecond =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testNew (in category 'tests') -----
- testNew
- 	self assert: aDateAndTime =  (DateAndTime new).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testNoon (in category 'tests') -----
- testNoon
- 	self assert: aDateAndTime noon = '1901-01-01T12:00:00+00:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testNow (in category 'tests') -----
- testNow
- 	self deny: aDateAndTime =  (DateAndTime now).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testOffset (in category 'tests') -----
- testOffset
- 	self assert: aDateAndTime offset =  '0:00:00:00' asDuration.
-      self assert: (aDateAndTime offset: '0:12:00:00') =  '1901-01-01T00:00:00+12:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testPlus (in category 'tests') -----
- testPlus
- 	self assert: aDateAndTime + '0:00:00:00' = aDateAndTime.
- 	self assert: aDateAndTime + 0 = aDateAndTime.
- 	self assert: aDateAndTime + aDuration = (DateAndTime year: 1901 month: 1 day: 2 hour: 2 minute: 3 second: 4 nanoSecond: 5 offset: 0 hours )
- 	" I believe this is a bug in the nanosecond part of (DateAndTime >> year:month:day:hour:minute:second:nanoSecond:offset:)"
- 	
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testPosixEpoch (in category 'tests - epoch') -----
- testPosixEpoch
- 	"The Smalltalk epoch happened, by agreed convention, 2177452800 seconds
- 	prior to the Posix epoch, which is defined as 1970-01-01T00:00:00+00:00.
- 
- 	Note for reference the corresponding implementation in the Unix VM:
- 
- 	/* Squeak epoch is Jan 1, 1901.  Unix epoch is Jan 1, 1970: 17 leap years
- 	   and 52 non-leap years later than Squeak. */
-  	return unixTime + ((52*365UL + 17*366UL) * 24*60*60UL);"
- 
- 	| epochInMichigan epochInKyoto posixEpoch epochDelta |
- 	epochDelta := 2177452800.
- 	self assert: epochDelta equals: ((52*365 + (17*366)) * 24*60*60). "cross check against VM code"
- 	posixEpoch := '1970-01-01T00:00:00+00:00' asDateAndTime.
- 	self assert: epochDelta equals: posixEpoch asSeconds.
- 	epochInMichigan := '1969-12-31T19:00:00-05:00' asDateAndTime.
- 	self assert: epochDelta equals: epochInMichigan asSeconds.
- 	self assert: posixEpoch equals: epochInMichigan.
- 	epochInKyoto := '1970-01-01T09:00:00+09:00' asDateAndTime.
- 	self assert: epochDelta equals: epochInKyoto asSeconds.
- 	self assert: posixEpoch equals: epochInKyoto.
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testPrintOn (in category 'tests') -----
- testPrintOn
- 	| ref ws |
- 	ref := '1901-01-01T00:00:00+00:00'.
- 	ws := '' writeStream.
- 	aDateAndTime printOn: ws.
- 	self assert: ws contents = ref.
- 	ref  := 'a TimeZone(ETZ)'.
- 	ws := '' writeStream.
- 	aTimeZone printOn:  ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testSecond (in category 'tests') -----
- testSecond
- 	self assert: aDateAndTime second =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testSeconds (in category 'tests') -----
- testSeconds
- 	self assert: aDateAndTime seconds =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testTicks (in category 'tests') -----
- testTicks
- 	self assert: aDateAndTime ticks =  (DateAndTime julianDayNumber: 2415386) ticks.
- 	self assert: aDateAndTime ticks = #(2415386 0 0)!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testTicksOffset (in category 'tests') -----
- testTicksOffset
- 	self assert: aDateAndTime =  (aDateAndTime ticks:  #(2415386 0 0) offset: DateAndTime localOffset).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testTo (in category 'tests') -----
- testTo
- 	self assert: (aDateAndTime to: aDateAndTime) = (DateAndTime new to: DateAndTime new) 
- 	"MessageNotUnderstood: UndefinedObject>>starting:ending:  where UndefinedObject is Timespan "!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testToBy (in category 'tests') -----
- testToBy
- 	self assert: (aDateAndTime to: aDateAndTime + 10 days by: 5 days) = 
- 				(DateAndTime new to: DateAndTime new + 10 days by: 5 days ) 
- 	"MessageNotUnderstood: UndefinedObject>>starting:ending:  where UndefinedObject is Timespan "!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testToByDo (in category 'tests') -----
- testToByDo
- 	"self assert: (aDateAndTime to: aDateAndTime + 10 days by: 5 days do: []) =  "
- 	"MessageNotUnderstood: UndefinedObject>>starting:ending:  where UndefinedObject is Timespan "!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testToday (in category 'tests') -----
- testToday
- 	self deny: aDateAndTime =  (DateAndTime today).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testTommorrow (in category 'tests') -----
- testTommorrow
- 	self assert: (DateAndTime today + 24 hours) =  (DateAndTime tomorrow).
- 	self deny: aDateAndTime =  (DateAndTime tomorrow).
-      "MessageNotUnderstood: Date class>>starting:"!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testUtcOffset (in category 'tests') -----
- testUtcOffset
-      self assert: (aDateAndTime utcOffset: '0:12:00:00') =  '1901-01-01T12:00:00+12:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYear (in category 'tests') -----
- testYear
- 	self assert: aDateAndTime year = 1901.
- 
- 	!

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYearDay (in category 'tests') -----
- testYearDay
- 	self assert: aDateAndTime =  (DateAndTime year: 1901 day: 1).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYearDayHourMinuteSecond (in category 'tests') -----
- testYearDayHourMinuteSecond
- 	self assert: aDateAndTime =  (DateAndTime year: 1901 day: 1 hour: 0 minute: 0 second: 0).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYearMonthDay (in category 'tests') -----
- testYearMonthDay
- 	self assert: aDateAndTime =  (DateAndTime year: 1901 month: 1 day: 1).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYearMonthDayHourMinuteSecond (in category 'tests') -----
- testYearMonthDayHourMinuteSecond
- 	self assert: aDateAndTime =  (DateAndTime year: 1901 month: 1 day: 1 hour: 0 minute: 0 second: 0).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYearMonthDayHourMinuteSecondNanosSecondOffset (in category 'tests') -----
- testYearMonthDayHourMinuteSecondNanosSecondOffset
- 	self assert: aDateAndTime =  (DateAndTime year: 1901 month: 1 day: 1 hour: 0 minute: 0 second: 0 nanoSecond: 0 offset:0 hours ).
- 	self assert: ((DateAndTime year: 1 month: 1 day: 1 hour: 0 minute: 0 second: 0 nanoSecond: 0 offset: 0 hours ) +
- 				(Duration days: 1 hours: 2 minutes: 3 seconds: 4  nanoSeconds: 5) ) =  	
- 				(DateAndTime year: 1 month: 1 day: 2 hour: 2 minute: 3 second: 4 nanoSecond: 5 offset: 0 hours ) 
- 	" I believe this is a bug in the nanosecond part of (DateAndTime >> year:month:day:hour:minute:second:nanoSecond:offset:)"" I believe this is a bug in the nanosecond part of (DateAndTime >> year:month:day:hour:minute:second:nanoSecond:offset:)"   
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testYesterday (in category 'tests') -----
- testYesterday
- 	self deny: aDateAndTime =  (DateAndTime yesterday).
- !

Item was removed:
- ----- Method: DateAndTimeEpochTest>>testtimeZone (in category 'tests') -----
- testtimeZone
- 	self assert: aDateAndTime timeZoneName	= 'Universal Time'.
- 	self assert: aDateAndTime timeZoneAbbreviation	=  'UTC'
- 
- !

Item was removed:
- TestCase subclass: #DateAndTimeLeapTest
- 	instanceVariableNames: 'aDateAndTime aDuration aTimeZone localTimeZoneToRestore localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !DateAndTimeLeapTest commentStamp: 'tlk 1/6/2004 17:54' prior: 0!
- I represent one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. tlk.
- My fixtures are:
- aDateAndTime = February 29, 2004 1:33 PM with offset: 2 hours
- aDuration = 15 days, 14 hours, 13 minutes, 12 seconds and 11 nano seconds.
- aTimeZone =  Grenwhich Meridian (local offset = 0 hours) !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>setUp (in category 'running') -----
- setUp
- 	localTimeZoneToRestore := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	DateAndTime localTimeZone: TimeZone default.
- 	aDateAndTime := (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours).
- 	aTimeZone := TimeZone default.
- 	aDuration := Duration days: 0 hours: 13 minutes: 33 seconds: 0 nanoSeconds: 0
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>tearDown (in category 'running') -----
- tearDown
-      DateAndTime localTimeZone: localTimeZoneToRestore.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-      "wish I could remove the time zones I added earlier, tut there is no method for that"
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsDate (in category 'testing') -----
- testAsDate
- 	self assert: (aDateAndTime offset: DateAndTime localTimeZone offset) asDate = 'February 29, 2004' asDate!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsDuration (in category 'testing') -----
- testAsDuration
- 	self assert: aDateAndTime asDuration =  aDuration
- 	
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsLocal (in category 'testing') -----
- testAsLocal
- 	self assert: aDateAndTime asLocal =  aDateAndTime.
- 	self assert: aDateAndTime asLocal = (aDateAndTime utcOffset: aDateAndTime class localOffset)
- 
- 	
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsMonth (in category 'testing') -----
- testAsMonth
- 	self assert:
- 		(aDateAndTime offset: Month defaultOffset) asMonth =
- 			(Month
- 				month: 'February'
- 				year: 2004)!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsNanoSeconds (in category 'testing') -----
- testAsNanoSeconds
- 	self assert: aDateAndTime asNanoSeconds =  aDuration asNanoSeconds.
- 	self assert: aDateAndTime asNanoSeconds = 48780000000000
- 	
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsSeconds (in category 'testing') -----
- testAsSeconds
- 	self assert: aDuration asSeconds =  48780.
- 	self assert: aDateAndTime asSeconds =  3255507180
- 	
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsTime (in category 'testing') -----
- testAsTime
- 	self assert: aDateAndTime asTime = (Time hour: 13 minute: 33 second: 0)
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsTimeStamp (in category 'testing') -----
- testAsTimeStamp
- 	self assert: aDateAndTime asTimeStamp =  ((TimeStamp readFrom: '2-29-2004 1:33 pm' readStream) offset: 2 hours).
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsUTC (in category 'testing') -----
- testAsUTC
- 	self assert: aDateAndTime asUTC =  aDateAndTime
- 
-           !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsWeek (in category 'testing') -----
- testAsWeek
- 	self assert: (aDateAndTime offset: DateAndTime localTimeZone offset) asWeek = (Week starting: '02-29-2004' asDate)!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testAsYear (in category 'testing') -----
- testAsYear
- 	| year |
- 	year := (aDateAndTime offset: DateAndTime localTimeZone offset) asYear.
- 	self assert: year = (Year starting: '02-29-2004' asDate).
- 	self deny: year = (Year starting: '01-01-2004' asDate)!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDay (in category 'testing') -----
- testDay
- 	self assert: aDateAndTime day =   60. 
- 	self deny: aDateAndTime day =   29 !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDayMonthYearDo (in category 'testing') -----
- testDayMonthYearDo
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachYear])  = 2004.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachMonth]) = 2.
- 	self assert: (aDateAndTime dayMonthYearDo: [:eachDay :eachMonth :eachYear |  eachDay]) = 29.
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDayOfMonth (in category 'testing') -----
- testDayOfMonth
- 	self assert: aDateAndTime dayOfMonth  = 29.
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDayOfWeek (in category 'testing') -----
- testDayOfWeek
- 	self assert: aDateAndTime dayOfWeek  = 1.
- 	self assert: aDateAndTime dayOfWeekAbbreviation = 'Sun'.
- 	self assert: aDateAndTime dayOfWeekName = 'Sunday'.
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDayOfYear (in category 'testing') -----
- testDayOfYear
- 	self assert: aDateAndTime dayOfYear  = 60.
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDaysInMonth (in category 'testing') -----
- testDaysInMonth
- 	self assert: aDateAndTime daysInMonth  = 29.
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDaysInYear (in category 'testing') -----
- testDaysInYear
- 	self assert: aDateAndTime daysInYear  = 366.
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testDaysLeftInYear (in category 'testing') -----
- testDaysLeftInYear
- 	self assert: aDateAndTime daysLeftInYear  = 306.
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testFirstDayOfMonth (in category 'testing') -----
- testFirstDayOfMonth
- 	self deny: aDateAndTime firstDayOfMonth =  1.
- 	self assert: aDateAndTime firstDayOfMonth = 32
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testFromString (in category 'testing') -----
- testFromString
- 	self assert: aDateAndTime =  (DateAndTime fromString: ' 2004-02-29T13:33:00+02:00').
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testHash (in category 'testing') -----
- testHash
- 	self assert: aDateAndTime hash =      1078054380000000
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testHour (in category 'testing') -----
- testHour
- 	self assert: aDateAndTime hour =    aDateAndTime hour24.
- 	self assert: aDateAndTime hour =    13.
- 	self assert: aDateAndTime hour =    aDateAndTime hours
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testHour12 (in category 'testing') -----
- testHour12
- 	self assert: aDateAndTime hour12  =   1.
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testIsLeapYear (in category 'testing') -----
- testIsLeapYear
- 	self assert: aDateAndTime isLeapYear
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testLessThan (in category 'testing') -----
- testLessThan
- 	self assert: aDateAndTime  < (aDateAndTime + '1:00:00:00').
- 	self assert: aDateAndTime + -1 < aDateAndTime.
- 	!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMeridianAbbreviation (in category 'testing') -----
- testMeridianAbbreviation
- 	self assert: aDateAndTime meridianAbbreviation = 'PM'.
- 
- 	!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMiddleOf (in category 'testing') -----
- testMiddleOf
- 	self assert: (aDateAndTime middleOf: aDuration)  = 
- 	 (Timespan starting: (DateAndTime year: 2004 month: 2 day: 29 hour: 6 minute: 46 second: 30 offset: 2 hours)
- 	duration: (Duration days: 0 hours: 13 minutes: 33 seconds: 0 nanoSeconds: 0 ))
- 	!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMidnight (in category 'testing') -----
- testMidnight
- 	| midnight |
- 	midnight := (aDateAndTime offset: DateAndTime localTimeZone offset) midnight.
- 	self assert: midnight = '2004-02-29T00:00:00+00:00' asDateAndTime.
- 	self deny: midnight = '2004-02-29T00:00:00+02:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMinute (in category 'testing') -----
- testMinute
- 	self assert: aDateAndTime minute =  33
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMinutes (in category 'testing') -----
- testMinutes
- 	self assert: aDateAndTime minutes = 33
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMonth (in category 'testing') -----
- testMonth
- 	self assert: aDateAndTime month  = 2.
- 	self assert: aDateAndTime monthAbbreviation = 'Feb'.
- 	self assert: aDateAndTime monthName = 'February'.
- 	self assert: aDateAndTime monthIndex = 2.!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testMonthParsing (in category 'testing') -----
- testMonthParsing
- 	self assert:
- 		(Month readFrom: 'Feb 2011' readStream) =
- 			(Month
- 				month: 2
- 				year: 2011)!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testNanoSecond (in category 'testing') -----
- testNanoSecond
- 	self assert: aDateAndTime nanoSecond =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testNoon (in category 'testing') -----
- testNoon
- 	self assert: aDateAndTime noon =  '2004-02-29T12:00:00+00:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testOffset (in category 'testing') -----
- testOffset
- 	self assert: aDateAndTime offset =  '0:02:00:00' asDuration.
-      self assert: (aDateAndTime offset: '0:12:00:00') =  '2004-02-29T13:33:00+12:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| ref ws |
- 	ref := '2004-02-29T13:33:00+02:00'.
- 	ws := '' writeStream.
- 	aDateAndTime printOn: ws.
- 	self assert: ws contents = ref.
- 	ref  := 'a TimeZone(UTC)'.
- 	ws := '' writeStream.
- 	aTimeZone printOn:  ws.
- 	self assert: ws contents = ref	!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testSecond (in category 'testing') -----
- testSecond
- 	self assert: aDateAndTime second =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testSeconds (in category 'testing') -----
- testSeconds
- 	self assert: aDateAndTime seconds =  0
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testTicks (in category 'testing') -----
- testTicks
- 	self assert: aDateAndTime ticks =  ((DateAndTime julianDayNumber: 2453065) + 48780 seconds) ticks.
- 	self assert: aDateAndTime ticks =  #(2453065 48780 0)!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testTicksOffset (in category 'testing') -----
- testTicksOffset
- 	self assert: aDateAndTime =  (aDateAndTime ticks:  #(2453065 48780 0) offset: DateAndTime localOffset).
- 
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testUtcOffset (in category 'testing') -----
- testUtcOffset
-      self assert: (aDateAndTime utcOffset: '0:02:00:00') =  '2004-02-29T13:33:00+02:00' asDateAndTime!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testYear (in category 'testing') -----
- testYear
- 	self assert: aDateAndTime year = 2004.
- 
- 	!

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testYearDayHourMinuteSecond (in category 'testing') -----
- testYearDayHourMinuteSecond
- 	self assert: aDateAndTime =  ((DateAndTime year: 2004 day: 60 hour: 13 minute: 33 second: 0) offset: 2 hours).
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testYearMonthDayHourMinuteSecond (in category 'testing') -----
- testYearMonthDayHourMinuteSecond
- 	self assert: aDateAndTime =  ((DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0) offset: 2 hours).
- !

Item was removed:
- ----- Method: DateAndTimeLeapTest>>testtimeZone (in category 'testing') -----
- testtimeZone
- 	self assert: aDateAndTime timeZoneName	= 'Universal Time'.
- 	self assert: aDateAndTime timeZoneAbbreviation	=  'UTC'
- 
- !

Item was removed:
- TestCase subclass: #DateAndTimeReferenceStreamTest
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !DateAndTimeReferenceStreamTest commentStamp: 'dtl 12/8/2018 15:03' prior: 0!
- Verify reference stream serialization for DateAndTime and Date. Tests are written in a Cronology-Classic image and should pass in a Chronology-UTC image.!

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testArrayOfDateAndTimeToBytes (in category 'testing') -----
- testArrayOfDateAndTimeToBytes
- 
- 	| a bytes expectedBytes |
- 	a := Array
- 		with: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		with: '2018-12-08T14:16:16.931528-05:00' asDateAndTime
- 		with: #endMarker.
- 	expectedBytes :=  #[8 0 0 0 3 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 5 0 10 4 0 0 200 176 16 3 0 33 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 55 133 253 64 6 9 101 110 100 77 97 114 107 101 114].
- 	bytes := (ReferenceStream on: ByteArray new writeStream)
- 		nextPut: a;
- 		yourself;
- 		contents.
- 	self assert: expectedBytes equals: bytes
- 		description: 'serialized bytes should match expected bytes'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testArrayWithDateToBytes (in category 'testing') -----
- testArrayWithDateToBytes
- 
- 	| date a bytes expectedBytes |
- 	date := Date
- 		starting: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		duration: 1 day + 13 seconds.
- 	a := Array
- 		with: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		with: date
- 		with: '2018-12-08T14:16:16.931528-05:00' asDateAndTime
- 		with: #endMarker.
- 	expectedBytes :=  #[8 0 0 0 4 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 9 0 0 0 3 6 4 68 97 116 101 16 5 0 10 4 0 0 134 206 16 3 0 33 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 3 0 33 4 0 0 0 0 4 0 1 81 141 16 5 0 10 4 0 0 200 176 16 3 0 33 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 55 133 253 64 6 9 101 110 100 77 97 114 107 101 114].
- 	bytes := (ReferenceStream on: ByteArray new writeStream)
- 		nextPut: a;
- 		yourself;
- 		contents.
- 	self assert: expectedBytes equals: bytes
- 		description: 'serialized bytes should match expected bytes'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testBytesToArrayOfDateAndTime (in category 'testing') -----
- testBytesToArrayOfDateAndTime
- 
- 	| bytes expected materializedArray |
- 	expected := Array
- 		with: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		with: '2018-12-08T14:16:16.931528-05:00' asDateAndTime
- 		with: #endMarker.
- .
- 	bytes :=   #[8 0 0 0 3 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 5 0 10 4 0 0 200 176 10 0 0 0 28 4 0 37 131 93 4 55 133 253 64 6 9 101 110 100 77 97 114 107 101 114].
- 	materializedArray  := (ReferenceStream on: bytes readStream) next.
- 	self assert: expected equals: materializedArray
- 		description: 'materialized from bytes should match expected array objects'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testBytesToArrayWithfDate (in category 'testing') -----
- testBytesToArrayWithfDate
- 
- 	| date bytes expected materializedArray |
- 	date := Date
- 		starting: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		duration: 1 day + 13 seconds.
- 	expected := Array
- 		with: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		with: date
- 		with: '2018-12-08T14:16:16.931528-05:00' asDateAndTime
- 		with: #endMarker.
- 	bytes :=   #[8 0 0 0 4 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 9 0 0 0 3 6 4 68 97 116 101 16 5 0 10 4 0 0 134 206 16 3 0 33 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 3 0 33 4 0 0 0 0 4 0 1 81 141 16 5 0 10 4 0 0 200 176 16 3 0 33 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 55 133 253 64 6 9 101 110 100 77 97 114 107 101 114].
- 	materializedArray  := (ReferenceStream on: bytes readStream) next.
- 	self assert: expected equals: materializedArray
- 		description: 'materialized from bytes should match expected array objects'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testBytesToDate (in category 'testing') -----
- testBytesToDate
- 
- 	| bytes expected materializedDate |
- 	expected := Date
- 		starting: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		duration: 1 day + 13 seconds.
- 	bytes :=  #[9 0 0 0 3 6 4 68 97 116 101 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 3 0 39 4 0 0 0 0 4 0 1 81 141].
- 	materializedDate  := (ReferenceStream on: bytes readStream) next.
- 	self assert: expected equals: materializedDate
- 		description: 'materialized from bytes should match expected DateAndTime'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testBytesToDateAndTime (in category 'testing') -----
- testBytesToDateAndTime
- 
- 	| bytes expected materializedDateAndTime |
- 	expected := '2018-12-08T09:35:10.913743-05:00' asDateAndTime.
- 	bytes :=  #[9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152].
- 	materializedDateAndTime  := (ReferenceStream on: bytes readStream) next.
- 	self assert: expected equals: materializedDateAndTime
- 		description: 'materialized from bytes should match expected DateAndTime'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testDateAndTimeToBytes (in category 'testing') -----
- testDateAndTimeToBytes
- 
- 	| dt bytes expectedBytes |
- 	dt := '2018-12-08T09:35:10.913743-05:00' asDateAndTime.
- 	expectedBytes :=  #[9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152].
- 	bytes := (ReferenceStream on: ByteArray new writeStream)
- 		nextPut: dt;
- 		yourself;
- 		contents.
- 	self assert: expectedBytes equals: bytes
- 		description: 'serialized bytes should match expected bytes'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testDateToBytes (in category 'testing') -----
- testDateToBytes
- 
- 	| date bytes expectedBytes |
- 	date := Date
- 		starting: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		duration: 1 day + 13 seconds.
- 	expectedBytes :=  #[9 0 0 0 3 6 4 68 97 116 101 9 0 0 0 5 6 11 68 97 116 101 65 110 100 84 105 109 101 4 0 0 134 206 9 0 0 0 3 6 8 68 117 114 97 116 105 111 110 4 0 0 0 0 4 255 255 185 176 4 0 37 131 93 4 54 118 156 152 16 3 0 39 4 0 0 0 0 4 0 1 81 141].
- 	bytes := (ReferenceStream on: ByteArray new writeStream)
- 		nextPut: date;
- 		yourself;
- 		contents.
- 	self assert: expectedBytes equals: bytes
- 		description: 'serialized bytes should match expected bytes'.
- 
- 
- !

Item was removed:
- ----- Method: DateAndTimeReferenceStreamTest>>testSeriailizeAndDeserializeArrayOfDateAndTime (in category 'testing') -----
- testSeriailizeAndDeserializeArrayOfDateAndTime
- 
- 	| date a bytes newArray |
- 	date := Date
- 		starting: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		duration: 1 day + 13 seconds.
- 	a := Array
- 		with: '2018-12-08T09:35:10.913743-05:00' asDateAndTime
- 		with: date
- 		with: '2018-12-08T14:16:16.931528-05:00' asDateAndTime
- 		with: #endMarker.
- 	bytes := (ReferenceStream on: ByteArray new writeStream)
- 		nextPut: a;
- 		yourself;
- 		contents.
- 	newArray := (ReferenceStream on: bytes readStream) next.
- 	self assert: a equals: newArray.
- 
- 
- !

Item was removed:
- ClassTestCase subclass: #DateAndTimeTest
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: DateAndTimeTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ DateAndTime
- 
- !

Item was removed:
- ----- Method: DateAndTimeTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| private | 
- 	private := #( #printOn: ).
- 
- 	^ super selectorsToBeIgnored, private
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testArithmeticAcrossDateBoundary (in category 'Tests') -----
- testArithmeticAcrossDateBoundary
- 
- 	| t1 t2 |
- 	t1 := '2004-01-07T11:55:00+00:00' asDateAndTime. 
- 	t2 := t1 - ( (42900+1) seconds).  
- 
- 	self 
- 		assert: t2 = ('2004-01-06T23:59:59+00:00' asDateAndTime)
- 		
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testAsSecondsIsTheSameInAnyTimezone (in category 'Tests') -----
- testAsSecondsIsTheSameInAnyTimezone
- 	"Using the Posix epoch as a convenient reference, verify that this point
- 	in time is represented with the same magnitude in any local time zone."
- 
- 	| posixEpochInVariousLocations |
- 	posixEpochInVariousLocations := {
- 		'1970-01-01T00:00:00+00:00' asDateAndTime .
- 		'1970-01-01T01:00:00+01:00' asDateAndTime .
- 		'1970-01-01T02:00:00+02:00' asDateAndTime .
- 		'1970-01-01T12:00:00+12:00' asDateAndTime .
- 		'1969-12-31T23:00:00-01:00' asDateAndTime .
- 		'1969-12-31T22:00:00-02:00' asDateAndTime .
- 		'1969-12-31T12:00:00-12:00' asDateAndTime
- 	}.
- 	posixEpochInVariousLocations do: [ :e |
- 		self assert: 2177452800 equals: e asSeconds ].
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingAnyOffset (in category 'Tests') -----
- testAsSecondsMatchesFromSecondsUsingAnyOffset
- 	"Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
- 	offset that does not match the current local time zone offset."
- 
- 	| aDateAndTime seconds newDateAndTime |
- 	aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours.
- 	seconds := aDateAndTime asSeconds.
- 	newDateAndTime := DateAndTime fromSeconds: seconds.
- 	self assert: seconds equals: newDateAndTime asSeconds.
- 
- 	"Repeat with another offset to ensure coverage"
- 	aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: -11 hours.
- 	seconds := aDateAndTime asSeconds.
- 	newDateAndTime := DateAndTime fromSeconds: seconds.
- 	self assert: seconds equals: newDateAndTime asSeconds.
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingCurrentLocalOffset (in category 'Tests') -----
- testAsSecondsMatchesFromSecondsUsingCurrentLocalOffset
- 	"Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
- 	offset that matches the current local time zone offset."
- 
- 	| seconds newDateAndTime now |
- 	now := DateAndTime now.
- 	seconds := now asSeconds.
- 	newDateAndTime := DateAndTime fromSeconds: seconds.
- 	self assert: seconds equals: newDateAndTime asSeconds.
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testAsSecondsMatchesFromSecondsUsingZeroOffset (in category 'Tests') -----
- testAsSecondsMatchesFromSecondsUsingZeroOffset
- 	"Verify that #asSeconds is symmetric with #fromSeconds: for an instance with
- 	zero offset as in UTC time."
- 
- 	| aDateAndTime seconds newDateAndTime |
- 	aDateAndTime := DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 0 hours.
- 	seconds := aDateAndTime asSeconds.
- 	newDateAndTime := DateAndTime fromSeconds: seconds.
- 	self assert: seconds equals: newDateAndTime asSeconds.
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testAsStringFromString (in category 'Tests') -----
- testAsStringFromString
- 	"Convert to string then back, verify same date and time. Skip years in the
- 	range 0 to 99 because they are interpreted relative to 2000."
- 
- 	| day hour dt min mo nano offset sec dtNew s |
- 	mo := 12.
- 	day := 2.
- 	hour := 2.
- 	min := 3.
- 	sec := 4.
- 	nano := 5.
- 	offset := 6 hours.
- 	(-2000 to: -1) , (100 to: 5000) do: [:yr |
- 		dt := DateAndTime 
- 			year: yr month: mo day: day 
- 			hour: hour minute: min second: sec nanoSecond: nano 
- 			offset: offset.
- 		s := dt asString.
- 		dtNew := DateAndTime fromString: s.
- 		self assert: dt equals: dtNew].
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testDateTimeDenotation1 (in category 'Tests') -----
- testDateTimeDenotation1
-   "DateAndTimeTest new testDateTimeDenotation1"
- 	
- 	 " Detroit is 5 hours behind UTC, this offset to UTC is therefore written with a minus sign. This example tests the correct interpretation of the DateAndTime denotation. "
- 
- 	| twoPmInLondon twoPmUTCInLocalTimeOfDetroit nineAmInDetroit |
- 	twoPmInLondon := DateAndTime
- 				year: 2004
- 				month: 11
- 				day: 2
- 				hour: 14
- 				minute: 0
- 				second: 0
- 				offset: 0 hours.
- 	twoPmUTCInLocalTimeOfDetroit := twoPmInLondon utcOffset: -5 hours.
- 	nineAmInDetroit  := '2004-11-02T09:00:00-05:00' asDateAndTime.
- 	self assert:  twoPmUTCInLocalTimeOfDetroit = nineAmInDetroit.
- 	
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testDateTimeDenotation2 (in category 'Tests') -----
- testDateTimeDenotation2
-   "DateAndTimeTest new testDateTimeDenotation2"
- 	
- 	 " Moscow is 3 hours ahead UTC, this offset to UTC is therefore positive. This example tests the correct interpretation of the DateAndTime denotation. "
- 
- 	| lateEveningInLondon lateEveningInLocalTimeOfMoscow
- 	 localMoscowTimeFromDenotation |
- 	lateEveningInLondon := DateAndTime
- 				year: 2004
- 				month: 11
- 				day: 30
- 				hour: 23
- 				minute: 30
- 				second: 0
- 				offset: 0 hours.
- 	lateEveningInLocalTimeOfMoscow := lateEveningInLondon utcOffset: 3 hours.
- 	localMoscowTimeFromDenotation  := '2004-12-01T02:30:00+03:00' asDateAndTime.
- 	self assert:  lateEveningInLocalTimeOfMoscow = localMoscowTimeFromDenotation.
- 	
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testErrorWhenDayIsAfterMonthEnd (in category 'Tests') -----
- testErrorWhenDayIsAfterMonthEnd
- 
- 	self
- 		should:
- 			[DateAndTime
- 				year: 2004
- 				month: 2
- 				day: 30]
- 		raise: Error.!

Item was removed:
- ----- Method: DateAndTimeTest>>testErrorWhenDayIsBeforeMonthStart (in category 'Tests') -----
- testErrorWhenDayIsBeforeMonthStart
- 
- 	self
- 		should:
- 			[DateAndTime
- 				year: 2004
- 				month: 2
- 				day: -1]
- 		raise: Error.
- 
- 	self
- 		should:
- 			[DateAndTime
- 				year: 2004
- 				month: 2
- 				day: 0]
- 		raise: Error.!

Item was removed:
- ----- Method: DateAndTimeTest>>testFromString (in category 'Tests') -----
- testFromString
- 
- 	| fromString fromStringNoOffset fromStringUTC |
- 	fromString := DateAndTime fromString: '-1199-01-05T20:33:14.321-05:00'.
- 	self assert: (fromString printString = '-1199-01-05T20:33:14.321-05:00').
- 	
- 	"if no offset is provided, the local offset should be used"
- 	fromStringNoOffset := DateAndTime fromString: '-1199-01-05T20:33:14.321'.
- 	self assert: (fromStringNoOffset offset = DateAndTime localOffset).
- 	
- 	"if a string contains the UTC designator Z, the local offset should not be used"
- 	fromStringUTC := DateAndTime fromString: '2011-08-26T18:00:03Z'.
- 	self assert: (fromStringUTC printString = '2011-08-26T18:00:03+00:00').!

Item was removed:
- ----- Method: DateAndTimeTest>>testGetSeconds (in category 'Tests') -----
- testGetSeconds
- 	"Verify that getSeconds represents whole seconds in the local time zone. For
- 	a given instance of DateAndTime, changing the time zone offset changes the
- 	local representation, but does not affect magnitude (time since a defiined
- 	epoch). Therefore, if time zone offset changes, the asSeconds value should
- 	not change, and the getSeconds value should change to reflect local timezone." 
- 
- 	| dt s1 id stSeconds seconds1 seconds2 |
- 	s1 :=  '2019-01-12T10:07:05.18743-05:00'.
- 	dt := s1 asDateAndTime.
- 	self assert: 18000 seconds negated equals: dt offset.
- 	seconds1 := dt getSeconds.
- 	self assert: 36425 equals: seconds1.
- 	id := dt identityHash.
- 	stSeconds := dt asSeconds.
- 	dt localOffsetSeconds: 0. "make the receiver's timezone GMT, do not change magnitude"
- 	self assert: id equals: dt identityHash. "same object, not a copy"
- 	self assert: '2019-01-12T15:07:05.18743+00:00' equals: dt asString.
- 	self assert: stSeconds equals: dt asSeconds. "magnitude unchanged"
- 	self assert: '2019-01-12T10:07:05.18743-05:00' asDateAndTime equals: dt. "still equal"
- 	seconds2 := dt getSeconds.
- 	self deny: seconds1 equals: seconds2.
- 	self assert: 54425 equals: seconds2.
- 
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testHash (in category 'Tests') -----
- testHash
- 	| date0 date1 date2 |
- 	date0 := DateAndTime unixEpoch.
- 	date1 := DateAndTime new ticks: (date0 + 1 hours) ticks offset: 0 hours.
- 	date2 := DateAndTime new ticks: (date0 - 2 hours) ticks offset: -3 hours.
- 	self assert: (date1 = date2) ==> [date1 hash = date2 hash]!

Item was removed:
- ----- Method: DateAndTimeTest>>testInstanceCreation (in category 'Tests') -----
- testInstanceCreation
- 
- 	| t |
- 	t := DateAndTime 
- 			year: 1 month: 1 day: 2 
- 			hour: 2 minute: 3 second: 4 nanoSecond: 5 
- 			offset: 6 hours.
- 	self 
- 		assert: (t julianDayNumber = 1721427);
- 		assert: (t offset = 6 hours);
- 		assert: (t hour = 2);
- 		assert: (t minute = 3);
- 		assert: (t second = 4);
- 		assert: (t nanoSecond = 5).
- 		
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testMonotonicity (in category 'Tests') -----
- testMonotonicity
- 
- 	| t1 t2 t3 t4 |
- 	t1 := DateAndTime now.
- 	t2 := DateAndTime now.
- 	(Delay forMilliseconds: 1000) wait.
- 	t3 := DateAndTime now.
- 	t4 := DateAndTime now.
- 
- 	self
- 		assert: (	t1 <= t2);
- 		assert: (	t2 < t3);
- 		assert: (	t3 <= t4).
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testPrecision (in category 'Tests') -----
- testPrecision
- 	"Verify that the clock is returning a value with accuracy of better than 1 second.  For now it seems sufficient to get two values and verify they are not the same."
- 
- 	| originalClockPolicy |
- 	originalClockPolicy := Time clockPolicy.
- 	[
- 		#(
- 			"#acceptPlatformTime is not listed here, because it doesn't guarantee monotoncity."
- 			monotonicAllowDuplicates <=
- 			monotonicForceMicrosecondIncrement <
- 			monotonicForceNanosecondIncrement <
- 		) pairsDo: [ :clockPolicy :comparator |
- 			| first second |
- 			Time clockPolicy: clockPolicy.
- 			first := DateAndTime now.
- 			second := DateAndTime now.
- 			self
- 				assert: (first perform: comparator with: second)
- 				description: ('Clock policy {1} didn''t compare with {2}' format: { clockPolicy. comparator }) ] ]
- 		ensure: [ Time clockPolicy: originalClockPolicy ]
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testPrintString (in category 'Tests') -----
- testPrintString
- 
- 	"(self new setTestSelector: #testPrintString) debug"
- 
- 	| dt dtNoOffset |
- 	dt :=DateAndTime
- 		year: 2004
- 		month: 11
- 		day: 2
- 		hour: 14
- 		minute: 3
- 		second: 5
- 		nanoSecond: 12345
- 		offset: (Duration seconds: (5 * 3600)).
- 	self assert: dt printString = '2004-11-02T14:03:05.000012345+05:00'.
- 	
- 	self assert: ('2002-05-16T17:20:45.1+01:01' asDateAndTime printString = '2002-05-16T17:20:45.1+01:01').
- 	self assert:	(' 2002-05-16T17:20:45.02+01:01' asDateAndTime printString = '2002-05-16T17:20:45.02+01:01').  
- 	self assert:	('2002-05-16T17:20:45.000000009+01:01' asDateAndTime printString =  '2002-05-16T17:20:45.000000009+01:01').
- 	self assert: ('2002-05-16T17:20:45+00:00' asDateAndTime printString = '2002-05-16T17:20:45+00:00' ).
- 	self assert: (' 2002-05-16T17:20:45+01:57' asDateAndTime printString = '2002-05-16T17:20:45+01:57').
- 	self assert: (' 2002-05-16T17:20:45-02:34' asDateAndTime printString = '2002-05-16T17:20:45-02:34').
- 	self assert: ('2002-05-16T17:20:45+00:00' asDateAndTime printString = '2002-05-16T17:20:45+00:00').
- 	self assert: ('1997-04-26T01:02:03+01:02:3' asDateAndTime printString = '1997-04-26T01:02:03+01:02:3').
- 
- 	"When no offset is provided, the local one is used"
- 	dtNoOffset := '2002-05-16T17:20' asDateAndTime.
- 	self assert: (('2002-05-16T17:20:00*' match: dtNoOffset printString) and: [dtNoOffset offset = DateAndTime localOffset]).
- 
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testReadFrom (in category 'Tests') -----
- testReadFrom
- 
- 	self assert: '-1199-01-05T20:33:14.321-05:00' equals: (DateAndTime readFrom: '-1199-01-05T20:33:14.321-05:00' readStream) printString.
- 	self assert: '-1199-01-05T20:33:14.321-05:00' equals: '-1199-01-05T20:33:14.321-05:00' asDateAndTime printString.
- 	self assert: '2002-05-16T17:20:45.1+01:01' equals: '2002-05-16T17:20:45.1+01:01' asDateAndTime printString.
- 	self assert: '2002-05-16T17:20:45.02+01:01' equals: ' 2002-05-16T17:20:45.02+01:01' asDateAndTime printString.  
- 	self assert: '2002-05-16T17:20:45.000000009+01:01' equals: '2002-05-16T17:20:45.000000009+01:01' asDateAndTime printString.
- 	self assert: '2002-05-16T17:20:45+01:57' equals: ' 2002-05-16T17:20:45+01:57' asDateAndTime printString.
- 	self assert: '2002-05-16T17:20:45-02:34' equals: ' 2002-05-16T17:20:45-02:34' asDateAndTime printString.
- 	self assert: '2002-05-16T17:20:45+00:00' equals: '2002-05-16T17:20:45+00:00' asDateAndTime printString.
- 	self assert: '1997-04-26T01:02:03+01:02:3' equals: '1997-04-26T01:02:03+01:02:3' asDateAndTime printString!

Item was removed:
- ----- Method: DateAndTimeTest>>testRestoreFromChronologyTicksAndOffset (in category 'Tests') -----
- testRestoreFromChronologyTicksAndOffset
- 	"Legacy serialized instances are made up of 3 SmallIntegers knowns as 'ticks' plus an 'offset' Duration.  Ensure a serialized DateAndTime can be correctly restored from these values."
- 	| dt newDt |
- 	dt := '2018-11-17T14:19:42.887676-06:00' asDateAndTime.
- 	newDt := DateAndTime basicNew ticks: dt ticks offset: dt offset.
- 	self assert: dt = newDt!

Item was removed:
- ----- Method: DateAndTimeTest>>testSmalltalk80Accessors (in category 'Tests') -----
- testSmalltalk80Accessors
- 
- 	| t |
- 	t := DateAndTime 
- 			year: 1 month: 1 day: 2 
- 			hour: 2 minute: 3 second: 4 nanoSecond: 5 
- 			offset: 6 hours.
- 	self 
- 		assert: (t hours = t hours);
- 		assert: (t minutes = t minute);
- 		assert: (t seconds = t second).
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testTimeZoneEquivalence (in category 'Tests') -----
- testTimeZoneEquivalence
-   "DateAndTimeTest new testTimeZoneEquivalence"
- 	"When the clock on the wall in Detroit says 9:00am, the clock on the wall
- 	in London says 2:00pm. The Duration difference between the corresponding
- 	DateAndTime values should be zero."
- 	
- 	 " Detroit is 5 hours behind UTC, this offset to UTC is therefore written with a minus sign. This example tests both the correct interpretation of the DateAndTime denotation and correct DateAndTime arithmetics. "
- 
- 	| twoPmInLondon nineAmInDetroit durationDifference |
- 	twoPmInLondon := '2004-11-02T14:00:00+00:00' asDateAndTime.
- 	nineAmInDetroit  := '2004-11-02T09:00:00-05:00' asDateAndTime.
- 	durationDifference := twoPmInLondon - nineAmInDetroit.
- 	self assert: durationDifference asSeconds = 0.
- 	self assert: twoPmInLondon = nineAmInDetroit
- !

Item was removed:
- ----- Method: DateAndTimeTest>>testTimeZoneEquivalence2 (in category 'Tests') -----
- testTimeZoneEquivalence2
-   "DateAndTimeTest new testTimeZoneEquivalence2"
- 	"This example demonstates the fact that
-         2004-05-24T22:40:00  UTC  is
-         2004-05-25T01:40:00  in Moscow
-      (Moscow is 3 hours ahead of UTC)  "
- 
- 	| thisMoment thisMomentInMoscow |
-     thisMoment := DateAndTime year: 2004 month: 5 day: 24 hour: 22 minute: 40.
-     thisMomentInMoscow := thisMoment utcOffset: 3 hours.
- 	self assert: (thisMoment - thisMomentInMoscow) asSeconds = 0.
- 	self assert: thisMoment = thisMomentInMoscow
- !

Item was removed:
- ClassTestCase subclass: #DateTest
- 	instanceVariableNames: 'date aDate aTime'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !DateTest commentStamp: 'brp 7/26/2003 16:58' prior: 0!
- This is the unit test for the class Date. !

Item was removed:
- ----- Method: DateTest>>assert:equals:addMonths: (in category 'testing') -----
- assert: expectedDateString equals: dateString addMonths: anInteger
- 
- 	self assert: expectedDateString asDate equals: (dateString asDate addMonths: anInteger)!

Item was removed:
- ----- Method: DateTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ self dateClass!

Item was removed:
- ----- Method: DateTest>>dateClass (in category 'Private') -----
- dateClass
- 
- 	^ Date!

Item was removed:
- ----- Method: DateTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	 | deprecated private special |
- 	deprecated := #().
- 	private := #().
- 	special := #( #< #= #new #next #previous #printOn: #printOn:format: #storeOn: #fromString: ).
- 
- 	^ super selectorsToBeIgnored, deprecated, private, special!

Item was removed:
- ----- Method: DateTest>>setUp (in category 'Running') -----
- setUp
- 
- 	date := '1973-06-02' asDate.
- 	aDate := '2004-01-23' asDate!

Item was removed:
- ----- Method: DateTest>>testAccessing (in category 'Tests') -----
- testAccessing
- 
- 	self	
- 		assert: date day = 153;
- 		assert: date julianDayNumber = 2441836;
- 		assert: date leap = 0;
- 		assert: date monthIndex = 6;
- 		assert: date monthName = #June;
- 		assert: date weekday = #Saturday;
- 		assert: date weekdayIndex = 7;
- 		assert: date year = 1973.
- !

Item was removed:
- ----- Method: DateTest>>testAddDays (in category 'testing') -----
- testAddDays
- 	self assert: (aDate addDays: 00) yyyymmdd =  '2004-01-23'.	
- 	self assert: (aDate addDays: 30) yyyymmdd =  '2004-02-22'.
- 	self assert: (aDate addDays: 60) yyyymmdd =  '2004-03-23'.
- 	self assert: (aDate addDays: 90) yyyymmdd =  '2004-04-22'.
- 	self assert: (aDate addDays:120) yyyymmdd =  '2004-05-22'!

Item was removed:
- ----- Method: DateTest>>testAddMonths (in category 'testing') -----
- testAddMonths
- 
- 	#(('2004-01-23' 0 '2004-01-23')
- 		('2004-01-23' 1 '2004-02-23')
- 		('2004-01-23' 2 '2004-03-23')
- 		('2004-01-23' 3 '2004-04-23')
- 		('2004-01-23' 12 '2005-01-23')
- 		('2017-05-31' 1 '2017-06-30')
- 		('2000-02-29' 12 '2001-02-28'))
- 			do: [:each | self assert: each third equals: each first addMonths: each second]!

Item was removed:
- ----- Method: DateTest>>testAddMonthsEndOfMonth (in category 'testing') -----
- testAddMonthsEndOfMonth
- 
- 	#(('2021-12-30' 1 '2022-01-30')
- 		('2022-01-30' 1 '2022-02-28')
- 		('2022-01-30' 2 '2022-03-30')
- 		('2022-01-30' 3 '2022-04-30')
- 		('2021-12-31' 1 '2022-01-31')
- 		('2022-01-31' 1 '2022-02-28')
- 		('2022-01-31' 2 '2022-03-31')
- 		('2022-01-31' 3 '2022-04-30'))
- 			do: [:each | self assert: each third equals: each first addMonths: each second]!

Item was removed:
- ----- Method: DateTest>>testAddMonthsEndOfMonthLeapYear (in category 'testing') -----
- testAddMonthsEndOfMonthLeapYear
- 
- 	#(('2023-12-30' 1 '2024-01-30')
- 		('2024-01-30' 1 '2024-02-29')
- 		('2024-01-30' 2 '2024-03-30')
- 		('2024-01-30' 3 '2024-04-30')
- 		('2023-12-31' 1 '2024-01-31')
- 		('2024-01-31' 1 '2024-02-29')
- 		('2024-01-31' 2 '2024-03-31')
- 		('2024-01-31' 3 '2024-04-30'))
- 			do: [:each | self assert: each third equals: each first addMonths: each second]!

Item was removed:
- ----- Method: DateTest>>testArithmetic (in category 'Tests') -----
- testArithmetic
- 	| d |
- 	d := date addDays: 32.		"4 July 1973"
- 
- 	self 
- 		assert: d year = 1973;
- 		assert: d monthIndex = 7;
- 		assert: d dayOfMonth = 4.
- 	self 
- 		assert: (d subtractDate: date) = 32;
- 		assert: (date subtractDate: d) = -32.
- 	self	 
- 		assert: (d subtractDays: 32) = date.
- !

Item was removed:
- ----- Method: DateTest>>testAsDate (in category 'testing') -----
- testAsDate
- 	self assert: (aDate asDate) = aDate
- !

Item was removed:
- ----- Method: DateTest>>testAsSeconds (in category 'testing') -----
- testAsSeconds
- 	self assert: (aDate asSeconds) =   3252268800.
- 	self assert: (aDate asSeconds) =  ((103*365*24*60*60) + (22+25"leap days"*24*60*60)) .
- 	self assert: aDate  =  (Date fromSeconds: 3252268800).!

Item was removed:
- ----- Method: DateTest>>testComparing (in category 'Tests') -----
- testComparing
- 	| d1 d2 d3 |
- 	d1 := self dateClass newDay: 2 month: #June year: 1973.
- 	d2 := self dateClass newDay: 97 year: 2003. 		"7 April 2003"
- 	d3 := self dateClass newDay: 250 year: 1865. 		"7 September 1865"
- 
- 	self
- 		assert: date = d1;
- 		assert: date = date copy;
- 		assert: date hash = d1 hash.
- 	self 
- 		assert: date < d2;
- 		deny: date < d3.
- !

Item was removed:
- ----- Method: DateTest>>testConverting (in category 'Tests') -----
- testConverting
- 
- 	self 
- 		assert: date asDate = date;
- 		assert: '2 June 1973' asDate = date;
- 		assert: date asSeconds = 2285280000.
- 
- 	date dayMonthYearDo: [ :d :m :y | self assert: d = 2; assert: m = 6; assert: y = 1973 ].!

Item was removed:
- ----- Method: DateTest>>testDateAndTimeNow (in category 'testing') -----
- testDateAndTimeNow
- 	"Not a great test: could falsely fail if midnight come in between the two executions and doesnt catch time errors"
- 	self assert: Date dateAndTimeNow first  = Date today 
- !

Item was removed:
- ----- Method: DateTest>>testDayMonthYearDo (in category 'testing') -----
- testDayMonthYearDo
- 	self assert: (aDate dayMonthYearDo: [:day :month :year | day asString , month asString, year asString]) = '2312004'
- !

Item was removed:
- ----- Method: DateTest>>testDaysInMonthForYear (in category 'testing') -----
- testDaysInMonthForYear
- 	self assert: (Date daysInMonth: 'February' forYear: 2008)  = 29.	
- 	self assert: (Date daysInMonth: 'February' forYear: 2000)  = 29.	
- 	self assert: (Date daysInMonth: 'February' forYear: 2100)  = 28.	
- 	self assert: (Date daysInMonth: 'July' forYear: 2100)  = 31.	!

Item was removed:
- ----- Method: DateTest>>testDaysInYear (in category 'testing') -----
- testDaysInYear
- 	self assert: (Date daysInYear: 2008)  = 366.	
- 	self assert: (Date daysInYear: 2000)  = 366.	
- 	self assert: (Date daysInYear: 2100)  = 365	
- !

Item was removed:
- ----- Method: DateTest>>testDuration (in category 'testing') -----
- testDuration
- 	self assert: aDate duration = 24 hours!

Item was removed:
- ----- Method: DateTest>>testEqual (in category 'testing') -----
- testEqual
- 	self assert: aDate = (Date readFrom: 'January 23, 2004' readStream)!

Item was removed:
- ----- Method: DateTest>>testFirstWeekdayOfMonthYear (in category 'testing') -----
- testFirstWeekdayOfMonthYear
- 	self assert: (Date firstWeekdayOfMonth: 'January' year: 2004)  = 5.	
- !

Item was removed:
- ----- Method: DateTest>>testFromDateAndTime (in category 'Tests') -----
- testFromDateAndTime
- 
- 	| aDateAndTime |
- 	aDateAndTime := '2018-10-22T22:51:38.322706-04:00' asDateAndTime.
- 	aDate := aDateAndTime asDate.
- 	self
- 		assert: aDate start offset
- 		equals: aDateAndTime offset
- 		description: 'Start time for a Date created from a DateAndTime should preserve local time offset'!

Item was removed:
- ----- Method: DateTest>>testFromDays (in category 'Tests') -----
- testFromDays
- 	| epoch d0 d1 d2 |
- 	epoch := self dateClass newDay: 1 year: 1901.
- 	d0 := self dateClass fromDays: 0. 			"1 January 1901"
- 	self assert: d0 = epoch.
- 
- 	d1 := self dateClass fromDays:  26450. 	"2 June 1973"
- 	self assert: d1 = date.
- 
- 	d2 := self dateClass fromDays: -100000.	"18 March 1627"
- 	self assert: d2 julianDayNumber = 2315386.
- 
- 	self assert: aDate  =  (Date fromDays:  37642).
- 	self assert: aDate  =  (Date fromDays: 103*365 + 22 + 25 "leap days") .
- 	!

Item was removed:
- ----- Method: DateTest>>testFromSeconds (in category 'Tests') -----
- testFromSeconds
- 	| d |
- 	d := self dateClass fromSeconds: 2285280000. 
- 	self
- 		assert: d = date.
- !

Item was removed:
- ----- Method: DateTest>>testFromString (in category 'Tests') -----
- testFromString
- 	#('2 June 1973' '2-JUN-73' '6.2.73' '2JUN73'
- 		'June 2, 1973' '6/2/73' '2JUN73'
- 		'1973-06-02' '1973-JUN-02' '1973-June-02')
- 			do: [:each | self assert: date equals: (self dateClass fromString: each)].
- 
- 	self assert: '1982-04-15' asDate equals: (self dateClass fromString: '15.4.82').
- 	self assert: '1982-12-04' asDate equals: (self dateClass fromString: '12.4.82').
- 
- 	self assert: '100-04-15' asDate equals: (self dateClass fromString: '15.4.100').
- 	self assert: '0100-04-15' asDate equals: (self dateClass fromString: '15.4.100').
- 	self assert: '1982-04-15' asDate equals: (self dateClass fromString: '15.4.82').
- 	self assert: '1969-04-15' asDate equals: (self dateClass fromString: '15.4.69').
- 	self assert: '2068-04-15' asDate equals: (self dateClass fromString: '15.4.68')!

Item was removed:
- ----- Method: DateTest>>testGeneralInquiries (in category 'Tests') -----
- testGeneralInquiries
- 
- 	| shuffled indices names now | 
- 
- 	shuffled := #(#January #February #March #April #May #June #July 
- 					#August #September #October #November #December) shuffled.
- 	indices := shuffled collect: [ :m | self dateClass indexOfMonth: m ].
- 	names := indices collect: [ :i | self dateClass nameOfMonth: i ].
- 	self assert: names = shuffled.
- 
- 	shuffled := #(#Monday #Tuesday #Wednesday #Thursday #Friday #Saturday #Sunday) shuffled.
- 	indices := shuffled collect: [ :m | self dateClass dayOfWeek: m ].
- 	names := indices collect: [ :i | self dateClass nameOfDay: i ].
- 	self assert: names = shuffled.
- 	
- 	now  := self dateClass dateAndTimeNow.
- 	self 
- 		assert: now size = 2;
- 		assert: now first = self dateClass today.
- 
- 	self assert: (self dateClass firstWeekdayOfMonth: #June year: 1973) = 6.
- 
- 	self
- 		assert: (self dateClass leapYear: 1973) = 0;
- 		assert: (self dateClass leapYear: 1972) = 1;
- 		assert: (self dateClass daysInYear: 1973) = 365;
- 		assert: (self dateClass daysInYear: 1972) = 366;
- 		assert: (self dateClass daysInMonth: #February forYear: 1973) = 28;
- 		assert: (self dateClass daysInMonth: #February forYear: 1972) = 29.
- !

Item was removed:
- ----- Method: DateTest>>testIndexOfMonth (in category 'testing') -----
- testIndexOfMonth
- 	self assert: (Date indexOfMonth: 'January')  = 1.	
- 	self assert: (Date indexOfMonth: 'December')  = 12.	!

Item was removed:
- ----- Method: DateTest>>testInitialization (in category 'Tests') -----
- testInitialization
- 
- 	self should: [ self dateClass initialize. true ].
- !

Item was removed:
- ----- Method: DateTest>>testInquiries (in category 'Tests') -----
- testInquiries
- 
- 	self	
- 		assert: date dayOfMonth = 2;
- 		assert: date dayOfYear = 153;
- 		assert: date daysInMonth = 30;
- 		assert: date daysInYear = 365;
- 		assert: date daysLeftInYear = (365 - 153);
- 		assert: date firstDayOfMonth = 152.
- !

Item was removed:
- ----- Method: DateTest>>testJulianDayNumber (in category 'testing') -----
- testJulianDayNumber
- 	self assert: aDate = (Date julianDayNumber: ((4713+2004)*365 +1323) ).  !

Item was removed:
- ----- Method: DateTest>>testLeap (in category 'testing') -----
- testLeap
- 	self assert: aDate leap = 1.	
- 
- !

Item was removed:
- ----- Method: DateTest>>testLeapNot (in category 'testing') -----
- testLeapNot
- 	self assert: (aDate addDays: 365) leap = 0
- !

Item was removed:
- ----- Method: DateTest>>testLessThan (in category 'testing') -----
- testLessThan
- 	self assert: aDate < (Date readFrom: (ReadStream on: '01-24-2004')).!

Item was removed:
- ----- Method: DateTest>>testMakeUTC (in category 'testing') -----
- testMakeUTC
- 	"Equal dates should compare equal regardless of which TimeZone they are created in."
- 
- 	| priorTz priorPreference march31stLocal march31stOcean | 
- 	priorTz := DateAndTime localTimeZone.
- 	priorPreference := DateAndTime automaticTimezone.
- 
- 	[DateAndTime 
- 		localTimeZone: (TimeZone
- 		offset: 9 hours
- 		name: 'Early Test Countries'
- 		abbreviation: 'Test Ocean Early'). 
-  
- 	march31stLocal := Date year: 2016 month: 3 day: 31.
- 	march31stLocal start: (march31stLocal start offset: DateAndTime localTimeZone offset).
-  
- 	DateAndTime
- 		localTimeZone: (TimeZone
- 		offset: -9 hours
- 		name: 'Late Test Countries'
- 		abbreviation: 'Test Ocean Late').
-  
- 	march31stOcean := Date year: 2016 month: 3 day: 31.
- 	march31stOcean start: (march31stOcean start offset: DateAndTime localTimeZone offset).] 
- 		ensure: [DateAndTime localTimeZone: priorTz.
- 				DateAndTime automaticTimezone: priorPreference].
-  
- 	self 
- 		deny: march31stLocal = march31stOcean;
- 		assert: march31stOcean > march31stLocal.
- 
-  	self 
- 		assert: march31stLocal makeUTC = march31stOcean makeUTC;
- 		deny: march31stOcean makeUTC > march31stLocal makeUTC;
- 		deny: march31stOcean makeUTC < march31stLocal makeUTC.!

Item was removed:
- ----- Method: DateTest>>testMmddyyyy (in category 'testing') -----
- testMmddyyyy
- 	self assert: aDate mmddyyyy =  '1/23/2004'!

Item was removed:
- ----- Method: DateTest>>testNameOfMonth (in category 'testing') -----
- testNameOfMonth
- 	self assert: (Date nameOfMonth: 5) = 'May'.	
- 	self assert: (Date nameOfMonth: 8) = 'August' !

Item was removed:
- ----- Method: DateTest>>testNew (in category 'Tests') -----
- testNew
- 	| epoch |
- 	epoch := self dateClass newDay: 1 year: 1901.
- 	self assert: (self dateClass new = epoch).!

Item was removed:
- ----- Method: DateTest>>testNewDayMonthYear (in category 'testing') -----
- testNewDayMonthYear
- 	self assert: aDate = (Date newDay: 23 month: 1 year: 2004)	
- !

Item was removed:
- ----- Method: DateTest>>testNewDayYear (in category 'testing') -----
- testNewDayYear
- 	self assert: aDate = (Date newDay: 23 year: 2004)	
- !

Item was removed:
- ----- Method: DateTest>>testPreviousFriday (in category 'testing') -----
- testPreviousFriday
- 	self assert: (aDate previous: 'Friday') yyyymmdd = '2004-01-16'
- 
- !

Item was removed:
- ----- Method: DateTest>>testPreviousNext (in category 'Tests') -----
- testPreviousNext
- 	| n p pt ps |
- 	n := date next.
- 	p := date previous.
- 
- 	self
- 		assert: n year = 1973;
- 		assert: n dayOfYear = 154;
- 		assert: p year = 1973;
- 		assert: p dayOfYear = 152.
- 
- 	pt := date previous: #Thursday.		"31 May 1973"
- 	self	
- 		assert: pt year = 1973;
- 		assert: pt dayOfYear = 151.
- 
- 	ps := date previous: #Saturday.		" 26 May 1973"
- 	self	
- 		assert: ps year = 1973;
- 		assert: ps dayOfYear = (153-7).
- !

Item was removed:
- ----- Method: DateTest>>testPreviousThursday (in category 'testing') -----
- testPreviousThursday
- 	self assert: (aDate previous: 'Thursday') yyyymmdd = '2004-01-22'
- 
- !

Item was removed:
- ----- Method: DateTest>>testPrintFormat (in category 'testing') -----
- testPrintFormat
- 	self assert: (aDate printFormat: #(1 2 3 $? 2 2)) =  '23?Jan?04'!

Item was removed:
- ----- Method: DateTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| ref ws |
- 	ref := '23 January 2004'.
- 	ws := '' writeStream.
- 	aDate printOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: DateTest>>testPrintOnFormat (in category 'testing') -----
- testPrintOnFormat
- 	| ref ws |
- 	ref :='04*Jan*23'.
- 	ws := '' writeStream.
- 	aDate printOn: ws format: #(3 2 1 $* 2 2).
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: DateTest>>testPrinting (in category 'Tests') -----
- testPrinting
- 
- 	self	
- 		assert: date mmddyyyy = '6/2/1973';
- 		assert: date yyyymmdd = '1973-06-02';
- 		assert: (date printFormat: #(3 1 2 $!! 2 1 1)) = '1973!!2!!Jun'.
- !

Item was removed:
- ----- Method: DateTest>>testReadFrom (in category 'Tests') -----
- testReadFrom
- 	#('2 June 1973' '2-JUN-73' '6.2.73' '2JUN73'
- 		'June 2, 1973' '6/2/73' '2JUN73'
- 		'1973-06-02' '1973-JUN-02' '1973-June-02')
- 			do: [:each | self assert: date equals: (self dateClass readFrom: each readStream)].
- 
- 	self assert: '1982-04-15' asDate equals: (self dateClass readFrom: '15.4.82' readStream).
- 	self assert: '1982-12-04' asDate equals: (self dateClass readFrom: '12.4.82' readStream).
- 	
- 	self assert: '100-04-15' asDate equals: (self dateClass readFrom: '15.4.100' readStream).
- 	self assert: '0100-04-15' asDate equals: (self dateClass readFrom: '15.4.100' readStream).
- 	self assert: '1982-04-15' asDate equals: (self dateClass readFrom: '15.4.82' readStream).
- 	self assert: '1969-04-15' asDate equals: (self dateClass readFrom: '15.4.69' readStream).
- 	self assert: '2068-04-15' asDate equals: (self dateClass readFrom: '15.4.68' readStream)!

Item was removed:
- ----- Method: DateTest>>testStarting (in category 'testing') -----
- testStarting
- 	self assert: aDate = (Date starting: ((DateAndTime fromString: '2004-01-23T12:12') offset: Date defaultOffset))!

Item was removed:
- ----- Method: DateTest>>testStoreOn (in category 'testing') -----
- testStoreOn
- 	| ref ws |
- 	ref := '''23 January 2004'' asDate'.
- 	ws := '' writeStream.
- 	aDate storeOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: DateTest>>testStoring (in category 'Tests') -----
- testStoring
- 
- 	self	
- 		assert: date storeString = '''2 June 1973'' asDate';
- 		assert: date = ('2 June 1973' asDate).
- !

Item was removed:
- ----- Method: DateTest>>testSubtractDate (in category 'testing') -----
- testSubtractDate
- 	self assert: (aDate subtractDate:(aDate addDays: 30)) = -30.	
- 	self assert: (aDate subtractDate:(aDate subtractDays: 00)) = 0.	
- 	self assert: (aDate subtractDate:(aDate subtractDays: 30)) = 30.
- 
- !

Item was removed:
- ----- Method: DateTest>>testSubtractDays (in category 'testing') -----
- testSubtractDays
- 	self assert: (aDate subtractDays: 00) yyyymmdd =  '2004-01-23'.	
- 	self assert: (aDate subtractDays: 30) yyyymmdd =  '2003-12-24'.
- 	self assert: (aDate subtractDays: 60) yyyymmdd =  '2003-11-24'
- !

Item was removed:
- ----- Method: DateTest>>testTomorrow (in category 'testing') -----
- testTomorrow
- 	"Not a great test: could falsely fail if midnight come in between the two executions and doesnt catch many errors"
- 	self assert: Date tomorrow  > Date today 
- !

Item was removed:
- ----- Method: DateTest>>testWeekday (in category 'testing') -----
- testWeekday
- 	self assert: aDate weekday = 'Friday'.	
- 	self assert: aDate weekdayIndex = 6. 
- 	self assert: (Date dayOfWeek: aDate weekday ) =6.
- 	self assert: (Date nameOfDay: 6 ) = 'Friday'	!

Item was removed:
- ----- Method: DateTest>>testYesterday (in category 'testing') -----
- testYesterday
- 	"Not a great test:  doesnt catch many errors"
- 	self assert: Date yesterday  < Date today 
- !

Item was removed:
- ----- Method: DateTest>>testYyyymmdd (in category 'testing') -----
- testYyyymmdd
- 	self assert: aDate yyyymmdd =  '2004-01-23'!

Item was removed:
- ClassTestCase subclass: #DurationTest
- 	instanceVariableNames: 'aDuration'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: DurationTest>>classToBeTested (in category 'coverage') -----
- classToBeTested
- 
- 	^ Duration
- 
- 
- !

Item was removed:
- ----- Method: DurationTest>>selectorsToBeIgnored (in category 'coverage') -----
- selectorsToBeIgnored
- 
- 	| private | 
- 	private := #( #printOn: ).
- 
- 	^ super selectorsToBeIgnored, private
- !

Item was removed:
- ----- Method: DurationTest>>setUp (in category 'running') -----
- setUp
- 	aDuration := Duration days: 1 hours: 2 minutes: 3 seconds: 4 nanoSeconds: 5 !

Item was removed:
- ----- Method: DurationTest>>testAbs (in category 'tests') -----
- testAbs
- 	self assert: aDuration abs = aDuration. 
- 	self assert: (Duration nanoSeconds: -5)  abs =  (Duration nanoSeconds: 5). 
- !

Item was removed:
- ----- Method: DurationTest>>testAgo (in category 'tests') -----
- testAgo
- 	self assert: ((10 minutes ago) isMemberOf: DateAndTime).
- 	self assert: ((10 weeks ago) < DateAndTime now).
- 	self assert: ((-50 seconds ago) > DateAndTime now).
- 	self assert: ((10 hours ago) < DateAndTime now).
- 	self assert: (0 seconds ago - DateAndTime now < 1 second).!

Item was removed:
- ----- Method: DurationTest>>testAsDelay (in category 'tests') -----
- testAsDelay
- 	self deny: aDuration asDelay =   aDuration.
- 	"want to come up with a more meaningful test"
- !

Item was removed:
- ----- Method: DurationTest>>testAsDuration (in category 'tests') -----
- testAsDuration
- 	self assert: aDuration asDuration =  aDuration
- 	
- !

Item was removed:
- ----- Method: DurationTest>>testAsMicroSeconds (in category 'tests') -----
- testAsMicroSeconds
- 	self assert: (Duration nanoSeconds: 1000) asMicroSeconds = 1.
- 	self assert: (Duration seconds: 1) asMicroSeconds = 1e6.
- 	self assert: aDuration asMicroSeconds = 93784000000.
- 	self assert: (Duration microSeconds: 3775000) asSeconds = 3.
- 	self assert: (Duration microSeconds: 3775000) nanoSeconds = 775000000!

Item was removed:
- ----- Method: DurationTest>>testAsMilliSeconds (in category 'tests') -----
- testAsMilliSeconds
- 	self assert: (Duration nanoSeconds: 1000000) asMilliSeconds = 1.
- 	self assert: (Duration seconds: 1) asMilliSeconds = 1000.
- 	self assert: (Duration nanoSeconds: 1000000) asMilliSeconds = 1.
- 	self assert: (Duration nanoSeconds: 1000000) asMilliSeconds = 1.
- 	self assert: aDuration asMilliSeconds = 93784000.
- 	self assert: (Duration milliSeconds: 3775) asSeconds = 3.
- 	self assert: (Duration milliSeconds: 3775) nanoSeconds = 775000000!

Item was removed:
- ----- Method: DurationTest>>testAsNanoSeconds (in category 'tests') -----
- testAsNanoSeconds
- 	self assert: (Duration nanoSeconds: 1)  asNanoSeconds = 1.
- 	self assert: (Duration seconds: 1)  asNanoSeconds = 1000000000.	
- 	self assert: aDuration   asNanoSeconds = 93784000000005.!

Item was removed:
- ----- Method: DurationTest>>testAsSeconds (in category 'tests') -----
- testAsSeconds
- 	self assert: (Duration nanoSeconds: 1000000000)  asSeconds = 1.
- 	self assert: (Duration seconds: 1)  asSeconds = 1.	
- 	self assert: aDuration   asSeconds = 93784.!

Item was removed:
- ----- Method: DurationTest>>testBusyWait (in category 'tests') -----
- testBusyWait
- 	
- 	| duration start elapsed |
- 	duration := Duration milliSeconds: 1.
- 	start := DateAndTime now.
- 	
- 	1000 timesRepeat: [duration busyWait].
- 	elapsed := DateAndTime now - start.
- 	
- 	self assert: elapsed >= (duration * 1000).
- 	self assert: elapsed <= (duration * 1000 * 2).!

Item was removed:
- ----- Method: DurationTest>>testComparing (in category 'tests') -----
- testComparing
- 
- 	| d1 d2 d3 |
- 	d1 := Duration seconds: 10 nanoSeconds: 1.
- 	d2 := Duration seconds: 10 nanoSeconds: 1.
- 	d3 := Duration seconds: 10 nanoSeconds: 2.
- 	
- 	self
- 		assert: (d1 = d1);
- 		assert: (d1 = d2);
- 		deny: (d1 = d3);
- 		assert: (d1 < d3)
- !

Item was removed:
- ----- Method: DurationTest>>testDays (in category 'tests') -----
- testDays
- 	self assert: aDuration   days = 1.
- 	self assert: (Duration   days: 1) days= 1.	!

Item was removed:
- ----- Method: DurationTest>>testDaysFromNumber (in category 'tests - from number') -----
- testDaysFromNumber
- 
- 	self assert: 5 equals: 5 days asSeconds / 86400.
- 	self assert: -5 equals: -5 days asSeconds / 86400.
- 	self assert: 1 equals: 1 days asSeconds / 86400.
- 	self assert: -1 equals: -1 days asSeconds / 86400.
- 	self assert: 0 equals: 0 days asSeconds / 86400.
- 	self assert: 1500 equals: 1.5 days asMilliSeconds / 86400.
- 	self assert: -1500 equals: -1.5 days asMilliSeconds / 86400.
- 
- 	self assert: 5 equals: 5 day asSeconds / 86400.
- 	self assert: -5 equals: -5 day asSeconds / 86400.
- 	self assert: 1 equals: 1 day asSeconds / 86400.
- 	self assert: -1 equals: -1 day asSeconds / 86400.
- 	self assert: 0 equals: 0 day asSeconds / 86400.
- 	self assert: 1500 equals: 1.5 day asMilliSeconds / 86400.
- 	self assert: -1500 equals: -1.5 day asMilliSeconds / 86400.
- !

Item was removed:
- ----- Method: DurationTest>>testDivide (in category 'tests') -----
- testDivide
- 	self assert: aDuration / aDuration = 1. 
- 	self assert: aDuration / 2 = (Duration days: 0 hours: 13 minutes: 1 seconds: 32 nanoSeconds: 2). 
- 	self assert: aDuration / (1/2) = (Duration days: 2 hours: 4 minutes: 6 seconds: 8 nanoSeconds: 10).
- !

Item was removed:
- ----- Method: DurationTest>>testFromNow (in category 'tests') -----
- testFromNow
- 
- 	self assert: ((10 seconds fromNow) > DateAndTime now).
- 	self assert: ((0 days fromNow - DateAndTime now) < 1 second).
- 	self assert: ((-1 weeks fromNow) < DateAndTime now).
- 	self assert: ((1000 milliSeconds fromNow) isMemberOf: DateAndTime).
- 	self assert: ((250 hours fromNow) > DateAndTime now).
- 	self assert: ((-50 minutes fromNow) < DateAndTime now).!

Item was removed:
- ----- Method: DurationTest>>testFromString (in category 'tests') -----
- testFromString
- 	self assert: aDuration = (Duration fromString: '1:02:03:04.000000005').
- !

Item was removed:
- ----- Method: DurationTest>>testHash (in category 'tests') -----
- testHash
- 	self assert: aDuration hash =    	(Duration days: 1 hours: 2 minutes: 3 seconds: 4 nanoSeconds: 5) hash.
- 	self assert: aDuration hash =     93789
- 	"must be a more meaningful test?"!

Item was removed:
- ----- Method: DurationTest>>testHours (in category 'tests') -----
- testHours
- 	self assert: aDuration   hours = 2.
- 	self assert: (Duration   hours: 2) hours = 2.	!

Item was removed:
- ----- Method: DurationTest>>testHoursFromNumber (in category 'tests - from number') -----
- testHoursFromNumber
- 
- 	self assert: 5 equals: 5 hours asSeconds / 3600.
- 	self assert: -5 equals: -5 hours asSeconds / 3600.
- 	self assert: 1 equals: 1 hours asSeconds / 3600.
- 	self assert: -1 equals: -1 hours asSeconds / 3600.
- 	self assert: 0 equals: 0 hours asSeconds / 3600.
- 	self assert: 1500 equals: 1.5 hours asMilliSeconds / 3600.
- 	self assert: -1500 equals: -1.5 hours asMilliSeconds / 3600.
- 
- 	self assert: 5 equals: 5 hour asSeconds / 3600.
- 	self assert: -5 equals: -5 hour asSeconds / 3600.
- 	self assert: 1 equals: 1 hour asSeconds / 3600.
- 	self assert: -1 equals: -1 hour asSeconds / 3600.
- 	self assert: 0 equals: 0 hour asSeconds / 3600.
- 	self assert: 1500 equals: 1.5 hour asMilliSeconds / 3600.
- 	self assert: -1500 equals: -1.5 hour asMilliSeconds / 3600.
- !

Item was removed:
- ----- Method: DurationTest>>testIntegerDivision (in category 'tests') -----
- testIntegerDivision
- 	self assert: aDuration // aDuration = 1. 
- 	self assert: aDuration // 2 =  (aDuration / 2). 
- 	"is there ever a case where this is not true, since precision is always to the nano second?"!

Item was removed:
- ----- Method: DurationTest>>testLessThan (in category 'tests') -----
- testLessThan
- 	self assert: aDuration  < (aDuration + 1 day ).
- 	self deny: aDuration < aDuration.
- 	!

Item was removed:
- ----- Method: DurationTest>>testMicroSecondsFromNumber (in category 'tests - from number') -----
- testMicroSecondsFromNumber
- 
- 	self assert: 5 equals: 5 microSeconds asMicroSeconds.
- 	self assert: -5 equals: -5 microSeconds asMicroSeconds.
- 	self assert: 1 equals: 1 microSeconds asMicroSeconds.
- 	self assert: -1 equals: -1 microSeconds asMicroSeconds.
- 	self assert: 0 equals: 0 microSeconds asMicroSeconds.
- 	self assert: 1500 equals: 1.5 microSeconds asNanoSeconds.
- 	self assert: -1500 equals: -1.5 microSeconds asNanoSeconds.
- 
- 	self assert: 5 equals: 5 microSecond asMicroSeconds.
- 	self assert: -5 equals: -5 microSecond asMicroSeconds.
- 	self assert: 1 equals: 1 microSecond asMicroSeconds.
- 	self assert: -1 equals: -1 microSecond asMicroSeconds.
- 	self assert: 0 equals: 0 microSecond asMicroSeconds.
- 	self assert: 1500 equals: 1.5 microSecond asNanoSeconds.
- 	self assert: -1500 equals: -1.5 microSecond asNanoSeconds.
- !

Item was removed:
- ----- Method: DurationTest>>testMilliSeconds (in category 'tests') -----
- testMilliSeconds
- 
- 	#(
- 		"argument (milliseconds)	seconds	nanoseconds"
- 		(5							0			5000000)
- 		(1005						1			5000000)
- 		(-5							0			-5000000)
- 		(-1005						-1			-5000000)
- 		(1234567					1234		567000000)
- 		(-1234567					-1234		-567000000)		
- 	) do: [ :each |
- 		| duration |
- 		duration := Duration milliSeconds: each first.
- 		self assert: duration asSeconds = each second.
- 		self assert: duration nanoSeconds = each third ]!

Item was removed:
- ----- Method: DurationTest>>testMilliSecondsFromNumber (in category 'tests - from number') -----
- testMilliSecondsFromNumber
- 
- 	self assert: 5 equals: 5 milliSeconds asMilliSeconds.
- 	self assert: -5 equals: -5 milliSeconds asMilliSeconds.
- 	self assert: 1 equals: 1 milliSeconds asMilliSeconds.
- 	self assert: -1 equals: -1 milliSeconds asMilliSeconds.
- 	self assert: 0 equals: 0 milliSeconds asMilliSeconds.
- 	self assert: 1500 equals: 1.5 milliSeconds asMicroSeconds.
- 	self assert: -1500 equals: -1.5 milliSeconds asMicroSeconds.
- 
- 	self assert: 5 equals: 5 milliSecond asMilliSeconds.
- 	self assert: -5 equals: -5 milliSecond asMilliSeconds.
- 	self assert: 1 equals: 1 milliSecond asMilliSeconds.
- 	self assert: -1 equals: -1 milliSecond asMilliSeconds.
- 	self assert: 0 equals: 0 milliSecond asMilliSeconds.
- 	self assert: 1500 equals: 1.5 milliSecond asMicroSeconds.
- 	self assert: -1500 equals: -1.5 milliSecond asMicroSeconds.
- !

Item was removed:
- ----- Method: DurationTest>>testMinus (in category 'tests') -----
- testMinus
- 	self assert: aDuration - aDuration = (Duration seconds: 0).
- 	self assert: aDuration - (Duration days: -1 hours: -2 minutes: -3 seconds: -4 nanoSeconds: -5) = 
- 						    (Duration days: 2  hours: 4  minutes: 6  seconds: 8  nanoSeconds: 10). 
- 	self assert: aDuration - (Duration days: 0  hours: 1  minutes: 2  seconds: 3  nanoSeconds: 4) = 
- 						    (Duration days: 1  hours: 1  minutes: 1  seconds: 1  nanoSeconds: 1). 
- 	self assert: aDuration - (Duration days: 0  hours: 3   minutes: 0  seconds: 5  nanoSeconds: 0) = 
- 						    (Duration days: 0  hours: 23  minutes: 2  seconds: 59  nanoSeconds: 5). !

Item was removed:
- ----- Method: DurationTest>>testMinutes (in category 'tests') -----
- testMinutes
- 	self assert: aDuration   minutes = 3.
- 	self assert: (Duration minutes: 3) minutes = 3.	!

Item was removed:
- ----- Method: DurationTest>>testMinutesFromNumber (in category 'tests - from number') -----
- testMinutesFromNumber
- 
- 	self assert: 5 equals: 5 minutes asSeconds / 60.
- 	self assert: -5 equals: -5 minutes asSeconds / 60.
- 	self assert: 1 equals: 1 minutes asSeconds / 60.
- 	self assert: -1 equals: -1 minutes asSeconds / 60.
- 	self assert: 0 equals: 0 minutes asSeconds / 60.
- 	self assert: 1500 equals: 1.5 minutes asMilliSeconds / 60.
- 	self assert: -1500 equals: -1.5 minutes asMilliSeconds / 60.
- 
- 	self assert: 5 equals: 5 minute asSeconds / 60.
- 	self assert: -5 equals: -5 minute asSeconds / 60.
- 	self assert: 1 equals: 1 minute asSeconds / 60.
- 	self assert: -1 equals: -1 minute asSeconds / 60.
- 	self assert: 0 equals: 0 minute asSeconds / 60.
- 	self assert: 1500 equals: 1.5 minute asMilliSeconds / 60.
- 	self assert: -1500 equals: -1.5 minute asMilliSeconds / 60.
- !

Item was removed:
- ----- Method: DurationTest>>testModulo (in category 'tests') -----
- testModulo
- 
- 	| d1 d2 d3 |
- 	d1 := 11.5 seconds.
- 	d2 := d1 \\ 3.
- 	self assert: d2 = (Duration nanoSeconds: 1).
- 
- 	d3 := d1 \\ (3 seconds).
- 	self assert: d3 =  (Duration seconds: 2 nanoSeconds: 500000000).
- 
- 	self assert: aDuration \\ aDuration = 
- 		(Duration days: 0 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0). 
- 	self assert: aDuration \\ 2 = 
- 		(Duration days: 0 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 1).
- 	
- 
- !

Item was removed:
- ----- Method: DurationTest>>testMonthDurations (in category 'tests') -----
- testMonthDurations
- 
- 	| jan feb dec |
- 	jan := Duration month: #January.
- 	feb := Duration month: #February.
- 	dec := Duration month: #December.
- 	
- 	self 
- 		assert: jan = (Year current months first duration);
- 		assert: feb = (Year current months second duration);
- 		assert: dec = (Year current months last duration)
- 
- 		
- !

Item was removed:
- ----- Method: DurationTest>>testMultiply (in category 'tests') -----
- testMultiply
- 	self assert: aDuration * 2 = (Duration days: 2 hours: 4 minutes: 6 seconds: 8 nanoSeconds: 10). !

Item was removed:
- ----- Method: DurationTest>>testNanoSeconds (in category 'tests') -----
- testNanoSeconds
- 	self assert: aDuration nanoSeconds = 5.
- 	self assert: (Duration nanoSeconds: 5) nanoSeconds = 5.	!

Item was removed:
- ----- Method: DurationTest>>testNanoSecondsFromNumber (in category 'tests - from number') -----
- testNanoSecondsFromNumber
- 
- 	self assert: 5 equals: 5 nanoSeconds asNanoSeconds.
- 	self assert: -5 equals: -5 nanoSeconds asNanoSeconds.
- 	self assert: 1 equals: 1 nanoSeconds asNanoSeconds.
- 	self assert: -1 equals: -1 nanoSeconds asNanoSeconds.
- 	self assert: 0 equals: 0 nanoSeconds asNanoSeconds.
- 
- 	self assert: 5 equals: 5 nanoSecond asNanoSeconds.
- 	self assert: -5 equals: -5 nanoSecond asNanoSeconds.
- 	self assert: 1 equals: 1 nanoSecond asNanoSeconds.
- 	self assert: -1 equals: -1 nanoSecond asNanoSeconds.
- 	self assert: 0 equals: 0 nanoSecond asNanoSeconds.
- !

Item was removed:
- ----- Method: DurationTest>>testNegated (in category 'tests') -----
- testNegated
- 	self assert: aDuration + aDuration negated = (Duration seconds: 0). 
- !

Item was removed:
- ----- Method: DurationTest>>testNegative (in category 'tests') -----
- testNegative
- 	self deny: aDuration negative.
- 	self assert: aDuration negated negative
- !

Item was removed:
- ----- Method: DurationTest>>testNew (in category 'tests') -----
- testNew
- 
- 	self assert: Duration new =  (Duration seconds: 0)!

Item was removed:
- ----- Method: DurationTest>>testNormalizeNanoSeconds (in category 'tests') -----
- testNormalizeNanoSeconds
- 	"Subtraction of two DateAndTime values may result in a request to
- 	create a Duration with negative nanoseconds and positive seconds.
- 	The resulting Duration should be normalized, otherwise its printString
- 	will be invalid."
- 
- 	| d t1 t2 |
- 	t1 := '2004-01-07T11:55:01+00:00' asDateAndTime. 
- 	t2 := '2004-01-07T11:55:00.9+00:00' asDateAndTime.
- 	d := t1 - t2. "100 millisecond difference"
- 	self assert: d nanoSeconds > 0.
- 	self assert: d seconds = 0.
- 	self assert: d nanoSeconds = 100000000.
- 	self assert: d asString = '0:00:00:00.100'.
- 	"Verify that other combinations produces reasonable printString values"
- 	self assert: (Duration seconds: 1 nanoSeconds: 100000000) printString = '0:00:00:01.100'.
- 	self assert: (Duration seconds: -1 nanoSeconds: -100000000) printString = '-0:00:00:01.100'.
- 	self assert: (Duration seconds: 1 nanoSeconds: -100000000) printString = '0:00:00:00.900'.
- 	self assert: (Duration seconds: -1 nanoSeconds: 100000000) printString = '-0:00:00:00.900'
- !

Item was removed:
- ----- Method: DurationTest>>testNumberConvenienceMethods (in category 'tests') -----
- testNumberConvenienceMethods
- 
- 	self
- 		assert: 1 week = (Duration days: 7);
- 		assert: -1 week = (Duration days: -7);
- 		assert: 1 day = (Duration days: 1);
- 		assert: -1 day = (Duration days: -1);
- 		assert: 1 hours = (Duration hours: 1);
- 		assert: -1 hour = (Duration hours: -1);
- 		assert: 1 minute = (Duration seconds: 60);
- 		assert: -1 minute = (Duration seconds: -60);
- 		assert: 1 second = (Duration seconds: 1);
- 		assert: -1 second = (Duration seconds: -1);
- 		assert: 1 milliSecond = (Duration milliSeconds: 1);
- 		assert: -1 milliSecond = (Duration milliSeconds: -1);
- 		assert: 1 nanoSecond = (Duration nanoSeconds: 1);
- 		assert: -1 nanoSecond = (Duration nanoSeconds: -1)
- 		!

Item was removed:
- ----- Method: DurationTest>>testPlus (in category 'tests') -----
- testPlus
- 	self assert: (aDuration + 0 hours) = aDuration.
- 	self assert: (aDuration + aDuration) = (Duration days: 2 hours: 4 minutes: 6 seconds: 8 nanoSeconds: 10). !

Item was removed:
- ----- Method: DurationTest>>testPositive (in category 'tests') -----
- testPositive
- 	self assert: (Duration nanoSeconds: 0) positive.
- 	self assert: aDuration positive.
- 	self deny: aDuration negated positive
- !

Item was removed:
- ----- Method: DurationTest>>testPrintOn (in category 'tests') -----
- testPrintOn
- 	| ref ws |
- 	ref := '1:02:03:04.000000005'.
- 	ws := '' writeStream.
- 	aDuration printOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: DurationTest>>testQuotient (in category 'tests') -----
- testQuotient
- 
- 	| d1 d2 q |
- 	d1 := 11.5 seconds.
- 	d2 := d1 // 3.
- 	self assert: d2 = (Duration seconds: 3 nanoSeconds: 833333333).
- 
- 	q := d1 // (3 seconds).
- 	self assert: q = 3.
- 
- !

Item was removed:
- ----- Method: DurationTest>>testReadFrom (in category 'tests') -----
- testReadFrom
- 	self assert: aDuration =  (Duration readFrom: (ReadStream on: '1:02:03:04.000000005'))
- !

Item was removed:
- ----- Method: DurationTest>>testReadFromTrailingDigits (in category 'tests') -----
- testReadFromTrailingDigits
- 	"http://bugs.squeak.org/view.php?id=6764"
- 	self should:  (Duration readFrom: '0:00:00:00.001 ' readStream) nanoSeconds = 1000000.!

Item was removed:
- ----- Method: DurationTest>>testRoundTo (in category 'tests') -----
- testRoundTo
- 
- 	self assert: ((5 minutes + 37 seconds) roundTo: (2 minutes)) = (6 minutes).
- 	
- 	self assert:  (aDuration roundTo: (Duration days: 1)) =
- 	               (Duration days: 1 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0).
- 	self assert:  (aDuration roundTo: (Duration hours: 1)) =
- 	               (Duration days: 1 hours: 2 minutes: 0 seconds: 0 nanoSeconds: 0).	
- 	self assert:  (aDuration roundTo: (Duration minutes: 1)) =
- 	               (Duration days: 1 hours: 2 minutes: 3 seconds: 0 nanoSeconds: 0).!

Item was removed:
- ----- Method: DurationTest>>testSeconds (in category 'tests') -----
- testSeconds
- 	self assert: aDuration seconds =   4.
- 	self assert: (Duration  nanoSeconds: 2) seconds = 0.
- 	self assert: (Duration nanoSeconds: 999999999) seconds = 0.
- 	self assert: (Duration nanoSeconds: 1000000001) seconds = 1.
- 	self assert: (Duration  seconds: 2) seconds = 2.	
- 	self assert: (Duration  days: 1 hours: 2 minutes: 3 seconds:4) seconds = 4.
- 	self deny: (Duration  days: 1 hours: 2 minutes: 3 seconds:4) seconds = (1*24*60*60+(2*60*60)+(3*60)+4).	!

Item was removed:
- ----- Method: DurationTest>>testSecondsFromNumber (in category 'tests - from number') -----
- testSecondsFromNumber
- 
- 	self assert: 5 equals: 5 seconds asSeconds.
- 	self assert: -5 equals: -5 seconds asSeconds.
- 	self assert: 1 equals: 1 seconds asSeconds.
- 	self assert: -1 equals: -1 seconds asSeconds.
- 	self assert: 0 equals: 0 seconds asSeconds.
- 	self assert: 1500 equals: 1.5 seconds asMilliSeconds.
- 	self assert: -1500 equals: -1.5 seconds asMilliSeconds.
- 
- 	self assert: 5 equals: 5 second asSeconds.
- 	self assert: -5 equals: -5 second asSeconds.
- 	self assert: 1 equals: 1 second asSeconds.
- 	self assert: -1 equals: -1 second asSeconds.
- 	self assert: 0 equals: 0 second asSeconds.
- 	self assert: 1500 equals: 1.5 second asMilliSeconds.
- 	self assert: -1500 equals: -1.5 second asMilliSeconds.
- !

Item was removed:
- ----- Method: DurationTest>>testSecondsNanoSeconds (in category 'tests') -----
- testSecondsNanoSeconds 
- 	self assert: (Duration   seconds: 0 nanoSeconds: 5)  = (Duration  nanoSeconds: 5).	
- 	"not sure I should include in sunit since its Private "
- 	self assert: (aDuration seconds: 0 nanoSeconds: 1) = (Duration nanoSeconds: 1). 
- !

Item was removed:
- ----- Method: DurationTest>>testStoreOn (in category 'tests') -----
- testStoreOn
-      self assert: (aDuration storeOn: (WriteStream on:'')) asString ='1:02:03:04.000000005'. 
-      "storeOn: returns a duration (self) not a stream"!

Item was removed:
- ----- Method: DurationTest>>testTicks (in category 'tests') -----
- testTicks
- 	self assert: aDuration ticks =  #(1 7384 5)!

Item was removed:
- ----- Method: DurationTest>>testTruncateTo (in category 'tests') -----
- testTruncateTo
- 
- 	self assert: ((5 minutes + 37 seconds) truncateTo: (2 minutes)) = (4 minutes).
- 	self assert:  (aDuration truncateTo: (Duration days: 1)) =
- 	               (Duration days: 1 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0).
- 	self assert:  (aDuration truncateTo: (Duration hours: 1)) =
- 	               (Duration days: 1 hours: 2 minutes: 0 seconds: 0 nanoSeconds: 0).	
- 	self assert:  (aDuration truncateTo: (Duration minutes: 1)) =
- 	               (Duration days: 1 hours: 2 minutes: 3 seconds: 0 nanoSeconds: 0).!

Item was removed:
- ----- Method: DurationTest>>testWait (in category 'tests') -----
- testWait
- 	
- 	| duration start elapsed |
- 	duration := Duration milliSeconds: 500.
- 	start := DateAndTime now.
- 	
- 	duration wait.
- 	elapsed := DateAndTime now - start.
- 	
- 	self assert: elapsed >= duration.
- 	self assert: elapsed <= (duration * 2).!

Item was removed:
- ----- Method: DurationTest>>testWeeks (in category 'tests') -----
- testWeeks
- 	self assert: (Duration  weeks: 1) days= 7.	!

Item was removed:
- ----- Method: DurationTest>>testWeeksFromNumber (in category 'tests - from number') -----
- testWeeksFromNumber
- 
- 	self assert: 5 equals: 5 weeks asSeconds / 604800.
- 	self assert: -5 equals: -5 weeks asSeconds / 604800.
- 	self assert: 1 equals: 1 weeks asSeconds / 604800.
- 	self assert: -1 equals: -1 weeks asSeconds / 604800.
- 	self assert: 0 equals: 0 weeks asSeconds / 604800.
- 	self assert: 1500 equals: 1.5 weeks asMilliSeconds / 604800.
- 	self assert: -1500 equals: -1.5 weeks asMilliSeconds / 604800.
- 
- 	self assert: 5 equals: 5 week asSeconds / 604800.
- 	self assert: -5 equals: -5 week asSeconds / 604800.
- 	self assert: 1 equals: 1 week asSeconds / 604800.
- 	self assert: -1 equals: -1 week asSeconds / 604800.
- 	self assert: 0 equals: 0 week asSeconds / 604800.
- 	self assert: 1500 equals: 1.5 week asMilliSeconds / 604800.
- 	self assert: -1500 equals: -1.5 week asMilliSeconds / 604800.
- !

Item was removed:
- ----- Method: DurationTest>>testZero (in category 'tests') -----
- testZero
- 	self assert: (Duration zero) = (Duration seconds: 0).	!

Item was removed:
- ClassTestCase subclass: #MonthTest
- 	instanceVariableNames: 'month'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !MonthTest commentStamp: 'brp 7/26/2003 22:44' prior: 0!
- This is the unit test for the class Month.
- !

Item was removed:
- ----- Method: MonthTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Month!

Item was removed:
- ----- Method: MonthTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| deprecated private special |
- 	deprecated := #().
- 	private := #( #printOn: ).
- 	special := #( #next ).
- 
- 	^ super selectorsToBeIgnored, deprecated, private, special.!

Item was removed:
- ----- Method: MonthTest>>setUp (in category 'Running') -----
- setUp
- 
- 	super setUp.
- 	month := Month month: 7 year: 1998.!

Item was removed:
- ----- Method: MonthTest>>tearDown (in category 'Running') -----
- tearDown
- 
- 	super tearDown.
- 	month := nil.!

Item was removed:
- ----- Method: MonthTest>>testConverting (in category 'Tests') -----
- testConverting
- 
- 	self assert: month asDate = '1 July 1998' asDate!

Item was removed:
- ----- Method: MonthTest>>testEnumerating (in category 'Tests') -----
- testEnumerating
- 	| weeks |
- 	weeks := OrderedCollection new.
- 	month weeksDo: [ :w | weeks add: w start ].
- 	0 to: 4 do: [ :i | weeks remove: (Week starting:  ('29 June 1998' asDate addDays: i * 7)) start ].
- 	self assert: weeks isEmpty!

Item was removed:
- ----- Method: MonthTest>>testIndexOfMonth (in category 'Tests') -----
- testIndexOfMonth
- 
- 	| m |
- 	m := #(#January #February #March #April #May #June #July #August #September #October #November #December).
- 	
- 	m withIndexDo: [:item :index | self assert: (Month indexOfMonth: item) = index].
- 	
- 	self shouldRaiseError: [Month indexOfMonth: 1].
- 	self shouldRaiseError: [Month indexOfMonth: #'1'].
- 	self shouldRaiseError: [Month indexOfMonth: #Marsh]. "notice the misspell!!"
- 	self shouldRaiseError: [Month indexOfMonth: #UnexistingMonth].!

Item was removed:
- ----- Method: MonthTest>>testInquiries (in category 'Tests') -----
- testInquiries
- 
- 	self 
- 		assert: month index = 7;
- 		assert: month name = #July;
- 		assert: month duration = (31 days).
- !

Item was removed:
- ----- Method: MonthTest>>testInstanceCreation (in category 'Tests') -----
- testInstanceCreation
- 	| m1 m2 |
- 	m1 := Month starting:  '4 July 1998' asDate.
- 	m2 := Month month: #July year: 1998.
- 	self
- 		assert: month = m1;
- 		assert: month = m2!

Item was removed:
- ----- Method: MonthTest>>testNameOfMonth (in category 'Tests') -----
- testNameOfMonth
- 
- 	| m |
- 	m := #(#January #February #March #April #May #June #July #August #September #October #November #December).
- 	
- 	m withIndexDo: [:item :index | self assert: (Month nameOfMonth: index) = item].
- 	
- 	self shouldRaiseError: [Month nameOfMonth: 0].
- 	self shouldRaiseError: [Month nameOfMonth: 13].
- 	self shouldRaiseError: [Month nameOfMonth: #January].!

Item was removed:
- ----- Method: MonthTest>>testPreviousNext (in category 'Tests') -----
- testPreviousNext
- 	| n p |
- 	n := month next.
- 	p := month previous.
- 
- 	self
- 		assert: n year = 1998;
- 		assert: n index = 8;
- 		assert: p year = 1998;
- 		assert: p index = 6.
- 
- !

Item was removed:
- ----- Method: MonthTest>>testPrinting (in category 'Tests') -----
- testPrinting
- 
- 	self 
- 		assert: month printString = 'July 1998'.
- !

Item was removed:
- ----- Method: MonthTest>>testReadFrom (in category 'Tests') -----
- testReadFrom
- 
- 	| m |
- 	m := Month readFrom: 'July 1998' readStream.
- 	self 
- 		assert: m = month!

Item was removed:
- ClassTestCase subclass: #ScheduleTest
- 	instanceVariableNames: 'firstEvent aSchedule restoredTimeZone localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: ScheduleTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Schedule
- 
- !

Item was removed:
- ----- Method: ScheduleTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| private | 
- 	private := #( #printOn: ).
- 
- 	^ super selectorsToBeIgnored, private
- !

Item was removed:
- ----- Method: ScheduleTest>>setUp (in category 'running') -----
- setUp
-  	 "Schedule is a type of Timespan representing repeated occurences of the same event. 
- 	The beginning of the schedule is the first occurrence of the event.
- 	A schedule maintains an array of Durations. 
- 	Each durations specify the offset to the next scheduled each. 
- 	The duration of each occurence of the event is not specified. 
- 	Nor are any other attributes such as name"
- 
- 	restoredTimeZone := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']).
- 
- 	"Create aSchedule with an event scheduled for 8:30pm every Saturday 
- 	and Sunday for the year 2003. "
- 	"Create the first event occurring on the first Saturday at 8:30 pm: 1/4/03"
- 	firstEvent :=  DateAndTime year: 2003 month: 1 day: 4 hour: 20 minute: 30. 
- 	
- 	"Create a schedule for one year starting with the first event" 
- 	aSchedule := Schedule starting: firstEvent duration: 52 weeks.
- 
- 	"Schedule the recurring events by scheduling the time in between each one.  
- 	One day for Sat-Sun. 6 days for Sun-Sat" 
- 	aSchedule schedule: { Duration days: 1. Duration days: 6 }.
- !

Item was removed:
- ----- Method: ScheduleTest>>tearDown (in category 'running') -----
- tearDown
- 
- 	DateAndTime localTimeZone: restoredTimeZone.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-  !

Item was removed:
- ----- Method: ScheduleTest>>testBetweenAndDoDisjointWithSchedule (in category 'testing') -----
- testBetweenAndDoDisjointWithSchedule
- 	| count |
- 	count := 0.
- 	aSchedule
- 		between: (DateAndTime
- 				year: 2004
- 				month: 4
- 				day: 1)
- 		and: (DateAndTime
- 				year: 2004
- 				month: 4
- 				day: 30)
- 		do: [:each | count := count + 1].
- 	self assert: count = 0!

Item was removed:
- ----- Method: ScheduleTest>>testBetweenAndDoIncludedInSchedule (in category 'testing') -----
- testBetweenAndDoIncludedInSchedule
- 	| count |
- 	count := 0.
- 	aSchedule
- 		between: (DateAndTime
- 				year: 2003
- 				month: 4
- 				day: 1)
- 		and: (DateAndTime
- 				year: 2003
- 				month: 4
- 				day: 30)
- 		do: [:each | count := count + 1].
- 	self assert: count = 8!

Item was removed:
- ----- Method: ScheduleTest>>testBetweenAndDoOverlappingSchedule (in category 'testing') -----
- testBetweenAndDoOverlappingSchedule
- 	| count |
- 	count := 0.
- 	aSchedule
- 		between: (DateAndTime
- 				year: 2002
- 				month: 12
- 				day: 1)
- 		and: (DateAndTime
- 				year: 2003
- 				month: 1
- 				day: 31)
- 		do: [:each | count := count + 1].
- 	self assert: count = 8!

Item was removed:
- ----- Method: ScheduleTest>>testDateAndTimes (in category 'testing') -----
- testDateAndTimes
- 	| answer |
- 	self assert: aSchedule dateAndTimes size  = 104.
- 	self assert: aSchedule dateAndTimes first = firstEvent.
- 	answer := true.
- 	aSchedule dateAndTimes do: [:each | (each dayOfWeekName = 'Saturday'
- 		or: [each dayOfWeekName = 'Sunday']) ifFalse: [^false]].
- 	self assert: answer
- !

Item was removed:
- ----- Method: ScheduleTest>>testExampleFromSwikiPage (in category 'testing') -----
- testExampleFromSwikiPage
- 	"It is often neccessary to schedule repeated events, like airline flight schedules, TV programmes, and file backups.
- 	 Schedule is a Timespan which maintains an array of Durations.
- 	 The durations specify the offset to the next scheduled DateAndTime. "
- 	"Consider a TV programme scheduled for 8:30pm every Saturday and Sunday for the current year. "
- 	"Find the first Saturday and set its time to 20h30"
- 	| sat shows |
- 	sat := Year current asMonth dates detect: [ :d | d dayOfWeekName = #Saturday ].
- 	sat := sat start + (Duration hours: 20.5).
- 	"Create a schedule" 
- 	shows := Schedule starting: sat ending: Year current end.
- 	shows schedule: { Duration days: 1. Duration days: 6 }.
- 	"To inspect:"
- 	shows dateAndTimes.
- 	shows dateAndTimes collect: [ :dt | dt dayOfWeekName ].
- 
- !

Item was removed:
- ----- Method: ScheduleTest>>testFromDateAndTime (in category 'Tests') -----
- testFromDateAndTime
- 
- 	| oc1 oc2 |
- 	oc1 := OrderedCollection new.
- 	DateAndTime today to: DateAndTime tomorrow by: 10 hours do: [ :dt | oc1 add: dt ].
- 
- 	oc2 := { DateAndTime today. 
- 			(DateAndTime today + 10 hours). 
- 				(DateAndTime today + 20 hours) }.
- 
- 	self assert: (oc1 asArray = oc2)!

Item was removed:
- ----- Method: ScheduleTest>>testIncludes (in category 'testing') -----
- testIncludes
- 	self assert: (aSchedule includes: (DateAndTime year: 2003 month: 6 day: 15 hour: 20 minute: 30 second: 0 offset: 0 hours))
- 	
- !

Item was removed:
- ----- Method: ScheduleTest>>testMonotonicity (in category 'Tests') -----
- testMonotonicity
- 
- 	| t1 t2 t3 t4 |
- 	t1 := DateAndTime now.
- 	t2 := DateAndTime now.
- 	t3 := DateAndTime now.
- 	t4 := DateAndTime now.
- 
- 	self 
- 		assert: (	t1 <= t2);
- 		assert: (	t2 <= t3);
- 		assert: (	t3 <= t4).
- !

Item was removed:
- ----- Method: ScheduleTest>>testSchedule (in category 'testing') -----
- testSchedule
- 	self assert: aSchedule schedule size = 2.
- 	self assert: aSchedule schedule first = 1 days.	
- 	self assert: aSchedule schedule second = 6 days.
- !

Item was removed:
- ClassTestCase subclass: #StopwatchTest
- 	instanceVariableNames: 'aStopwatch aDelay'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: StopwatchTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Stopwatch
- 
- !

Item was removed:
- ----- Method: StopwatchTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| private | 
- 	private := #( #printOn: #state: ).
- 
- 	^ super selectorsToBeIgnored, private
- !

Item was removed:
- ----- Method: StopwatchTest>>setUp (in category 'running') -----
- setUp
- 	aStopwatch := Stopwatch new.
- 	aDelay := Delay forMilliseconds: 1.!

Item was removed:
- ----- Method: StopwatchTest>>testActive (in category 'Tests') -----
- testActive
- 
- 	| sw |
- 	sw := Stopwatch new.
- 	sw activate.
- 	
- 	1 seconds asDelay wait.
- 	self 
- 		assert: (sw duration >= 1 seconds).
- 
- 	2 seconds asDelay wait.
- 	self 
- 		assert: (sw duration >= 3 seconds).
- 
- 	sw suspend.!

Item was removed:
- ----- Method: StopwatchTest>>testChangingStatus (in category 'testing') -----
- testChangingStatus
- 	aStopwatch activate.
- 	self assert: aStopwatch isActive.
- 	self assert: aStopwatch timespans size = 1.
- 	aStopwatch suspend.
- 	self assert: aStopwatch isSuspended.
- 	self assert: aStopwatch timespans size = 1.
- 	aStopwatch activate.
- 	aStopwatch reActivate.
- 	self assert: aStopwatch isActive.
- 	self assert: aStopwatch timespans size = 3.
- 	aStopwatch reset.
- 	self assert: aStopwatch isSuspended.
- 	self assert: aStopwatch timespans size = 0.!

Item was removed:
- ----- Method: StopwatchTest>>testInitialStatus (in category 'testing') -----
- testInitialStatus
- 	self assert: aStopwatch isSuspended.
- 	self deny: aStopwatch isActive.
- 	self assert: aStopwatch duration = 0 seconds!

Item was removed:
- ----- Method: StopwatchTest>>testMultipleTimings (in category 'testing') -----
- testMultipleTimings
- 	aStopwatch activate.
- 	aDelay wait.
- 	aStopwatch suspend.
- 	aStopwatch activate.
- 	aDelay wait.
- 	aStopwatch suspend.
- 	self assert: aStopwatch timespans size = 2. 
- 	self assert: aStopwatch timespans first asDateAndTime <= 
- 					aStopwatch timespans last asDateAndTime.
- !

Item was removed:
- ----- Method: StopwatchTest>>testNew (in category 'Tests') -----
- testNew
- 
- 	| sw |
- 	sw := Stopwatch new.
- 	
- 	self 
- 		assert: (sw isSuspended);
- 		assert: (sw state = #suspended);
- 		deny: (sw isActive);
- 		assert: (sw timespans isEmpty)
- 
- !

Item was removed:
- ----- Method: StopwatchTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| ref ws |
- 	ref := 'a Stopwatch(suspended:0:00:00:00)'.
- 	ws := '' writeStream.
- 	aStopwatch printOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: StopwatchTest>>testReActivate (in category 'Tests') -----
- testReActivate
- 
- 	| sw |
- 	sw := Stopwatch new.
- 	sw 
- 		activate;
- 		suspend;
- 		reActivate.
- 	
- 	self 
- 		assert: (sw isActive).
- !

Item was removed:
- ----- Method: StopwatchTest>>testReset (in category 'Tests') -----
- testReset
- 
- 	| sw |
- 	sw := Stopwatch new.
- 	sw activate.
- 	
- 	sw reset.
- 	self 
- 		assert: (sw isSuspended);
- 		assert: (sw timespans isEmpty)
- !

Item was removed:
- ----- Method: StopwatchTest>>testSingleTiming (in category 'testing') -----
- testSingleTiming
- 	| timeBefore |
- 	timeBefore := DateAndTime now.
- 	aStopwatch activate.
- 	aDelay wait.
- 	aStopwatch suspend.
- 	self assert: aStopwatch timespans size = 1. 
- 	self assert: aStopwatch timespans first asDateAndTime >= timeBefore. 
- 	self assert: aStopwatch timespans first asDateAndTime <= aStopwatch end.
- !

Item was removed:
- ----- Method: StopwatchTest>>testStartStop (in category 'Tests') -----
- testStartStop
- 
- 	| sw t1 t2 t3 t4 |
- 	sw := Stopwatch new.
- 	t1 := DateAndTime now.
- 	(Delay forMilliseconds: 10) wait.
- 	sw activate; activate.
- 	(Delay forMilliseconds: 10) wait.
- 	t2 := DateAndTime now.
- 	
- 	self 
- 		deny: (sw isSuspended);
- 		assert: (sw isActive);
- 		assert: (sw timespans size = 1);
- 		assert: (t1 <= sw start);
- 		assert: (sw start <= t2).
- 
- 	(Delay forMilliseconds: 10) wait.
- 	t3 := DateAndTime now.
- 	(Delay forMilliseconds: 10) wait.
- 	sw suspend; suspend.
- 	(Delay forMilliseconds: 10) wait.
- 	t4 := DateAndTime now.
- 
- 	self 
- 		assert: (sw isSuspended);
- 		deny: (sw isActive);
- 		assert: (sw timespans size = 1);
- 		assert: (sw end between: t3 and: t4);
- 		assert: (t3 <= sw end);
- 		assert: (sw end <= t4).
- !

Item was removed:
- ClassTestCase subclass: #TimeStampTest
- 	instanceVariableNames: 'timestamp aTimeStamp'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !TimeStampTest commentStamp: 'brp 7/26/2003 22:44' prior: 0!
- This is the unit test for the class TimeStamp.!

Item was removed:
- ----- Method: TimeStampTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ self timestampClass!

Item was removed:
- ----- Method: TimeStampTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| deprecated private special |
- 
- 	deprecated := #().
- 	private := #( #printOn: ).
- 	special := #().
- 
- 	^ super selectorsToBeIgnored, deprecated, private, special.!

Item was removed:
- ----- Method: TimeStampTest>>setUp (in category 'Running') -----
- setUp
- 
- 	timestamp := self timestampClass date: ('1-10-2000' asDate) time: ('11:55:00 am' asTime).
- 
- 	aTimeStamp := TimeStamp readFrom: '1-02-2004 12:34:56 am' readStream!

Item was removed:
- ----- Method: TimeStampTest>>tearDown (in category 'Running') -----
- tearDown
- 
- 	timestamp := nil.!

Item was removed:
- ----- Method: TimeStampTest>>testAccessing (in category 'Tests') -----
- testAccessing
- 
- 	| d t |
- 	d := '1-10-2000' asDate.
- 	t := '11:55:00 am' asTime.
- 
- 	self
- 		assert: (timestamp offset: Date defaultOffset) date = d;
- 		assert: (timestamp offset: Date defaultOffset) time = t.
- !

Item was removed:
- ----- Method: TimeStampTest>>testArithmetic (in category 'Tests') -----
- testArithmetic
- 
- 	| ts |
- 	ts := timestamp minusDays: 123.  	"9 September 1999, 11:55 am"
- 	ts := ts minusSeconds: 1056.			"9 September 1999, 11:37:24 am"
- 	ts := ts plusDays: 123.				"10 January 2000, 11:37:24 am"
- 	ts := ts plusSeconds: 1056.			"10 January 2000, 11:55 am"
- 	self
- 		assert: ts  = timestamp.
- 
- 	!

Item was removed:
- ----- Method: TimeStampTest>>testArithmeticAcrossDateBoundary (in category 'Tests') -----
- testArithmeticAcrossDateBoundary
- 
- 	| ts |
- 	ts := timestamp minusSeconds: ((11*3600) + (55*60) + 1).
- 	self
- 		assert: ts = ('1-9-2000 11:59:59 pm' asTimeStamp).
- 
- 	!

Item was removed:
- ----- Method: TimeStampTest>>testComparing (in category 'Tests') -----
- testComparing
- 
- 	| ts1 ts2 ts3 c1 c2 le |
- 	ts1 := self timestampClass date: ('01-10-2000' asDate) time: ('11:55:00 am' asTime).
- 	ts2 := self timestampClass date: ('07-26-2003' asDate) time: ('22:09:45 am' asTime).
- 	ts3 := self timestampClass date: ('05-28-1972' asDate) time: ('04:31:14 pm' asTime).
- 
- 	self
- 		assert: ts1 = timestamp;
- 		assert: ts1 hash = timestamp hash;
- 		assert: timestamp = timestamp copy;
- 		assert: ts1 < ts2;
- 		deny: ts1 < ts3.
- 
- 	c1 := self timestampClass current.
- 	c2 := self timestampClass current.
- 	le := (c1 <= c2).
- 	self assert: le.
- 
- !

Item was removed:
- ----- Method: TimeStampTest>>testConverting (in category 'Tests') -----
- testConverting
- 
- 	| d t |
- 	d := '1-10-2000' asDate.
- 	t := '11:55:00 am' asTime.
- 
- 	self
- 		assert: timestamp asSeconds = (d asSeconds + t asSeconds);
- 		assert: timestamp asDate = d;
- 		assert: timestamp asTime = t;
- 		assert: timestamp asTimeStamp == timestamp;
- 		assert: timestamp dateAndTime = {d. t}.
- !

Item was removed:
- ----- Method: TimeStampTest>>testDate (in category 'testing') -----
- testDate
- 	self assert: aTimeStamp date = '01-02-2004' asDate!

Item was removed:
- ----- Method: TimeStampTest>>testDateAndTime (in category 'testing') -----
- testDateAndTime
- 	self assert: aTimeStamp dateAndTime
- 			= (Array with: '01-02-2004' asDate with: '00:34:56' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testFromSeconds (in category 'Tests') -----
- testFromSeconds
- 
- 	self
- 		assert: (self timestampClass fromSeconds: 3124958100) = timestamp.!

Item was removed:
- ----- Method: TimeStampTest>>testFromString (in category 'Tests') -----
- testFromString
- 	"This should signal an exception in 3.6beta as Time>>fromString: does not exist."
- 
- 	self should: [ timestamp = (self timestampClass fromString: '1-10-2000 11:55:00 am') ] 
- 
- !

Item was removed:
- ----- Method: TimeStampTest>>testInstanceCreation (in category 'Tests') -----
- testInstanceCreation
- 
- 	self 
- 		should: [ self timestampClass midnight asDuration = (0 hours) ];
- 		should: [ self timestampClass noon asDuration = (12 hours) ].
- !

Item was removed:
- ----- Method: TimeStampTest>>testMinusDays (in category 'testing') -----
- testMinusDays
- 	self assert: (aTimeStamp minusDays: 5) dateAndTime
- 			= (Array with: '12-28-2003' asDate with: '00:34:56' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testMinusSeconds (in category 'testing') -----
- testMinusSeconds
- 	self assert: (aTimeStamp minusSeconds: 34 * 60 + 56) dateAndTime
- 			= (Array with: '01-02-2004' asDate with: '00:00:00' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testMinusSecondsOverMidnight (in category 'testing') -----
- testMinusSecondsOverMidnight
- 	self assert: (aTimeStamp minusSeconds: 34 * 60 + 57) dateAndTime
- 			= (Array with: '01-01-2004' asDate with: '23:59:59' asTime)
- 	"Bug The results are actual results are: #(1 January 2005 11:25:03 pm)"!

Item was removed:
- ----- Method: TimeStampTest>>testPlusDays (in category 'testing') -----
- testPlusDays
- 	self assert: (aTimeStamp plusDays: 366) dateAndTime
- 			= (Array with: '01-02-2005' asDate with: '00:34:56' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testPlusSeconds (in category 'testing') -----
- testPlusSeconds
- 	self assert: (aTimeStamp plusSeconds: 60 * 60 ) dateAndTime
- 			= (Array with: '01-02-2004' asDate with: '01:34:56' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testPlusSecondsOverMidnight (in category 'testing') -----
- testPlusSecondsOverMidnight
- 	self assert: (aTimeStamp plusSeconds: 24 * 60 * 60 + 1) dateAndTime
- 			= (Array with: '01-03-2004' asDate with: '00:34:57' asTime)!

Item was removed:
- ----- Method: TimeStampTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| ref ws |
- 	ref := '2 January 2004 12:34:56 am'.
- 	ws := '' writeStream.
- 	aTimeStamp printOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: TimeStampTest>>testPrinting (in category 'Tests') -----
- testPrinting
- 
- 	self	
- 		assert: timestamp printString = '10 January 2000 11:55 am'.
- !

Item was removed:
- ----- Method: TimeStampTest>>testReadFromA1 (in category 'testing') -----
- testReadFromA1
- 	"Conversion to and from a string (with implied UTC offset) is equal if
- 	and only if the time stamp has zero offset."
- 	|ts|
- 	ts := TimeStamp current offset: Duration zero. "current as UTC"
- 	self assert: (ts = (TimeStamp fromString: ts asString)).
- 	ts := TimeStamp current offset: (Duration hours: 1).
- 	self deny: (ts = (TimeStamp fromString: ts asString)).
- !

Item was removed:
- ----- Method: TimeStampTest>>testSorting (in category 'Tests') -----
- testSorting
- 
- 	| c1 c2 |
- 	c1 := self timestampClass current.
- 	c2 := self timestampClass current.
- 
- 	self
- 		assert: (self timestampClass current) <= (self timestampClass current);
- 		assert: (c1 <= c2).
- 
- 
- !

Item was removed:
- ----- Method: TimeStampTest>>testStoreOn (in category 'testing') -----
- testStoreOn
- 	| ref ws |
- 	ref := '''2 January 2004 12:34:56 am'' asTimeStamp'.
- 	ws := '' writeStream.
- 	aTimeStamp storeOn: ws.
- 	self assert: ws contents = ref!

Item was removed:
- ----- Method: TimeStampTest>>testTime (in category 'testing') -----
- testTime
- 	self assert: aTimeStamp time =  '00:34:56' asTime!

Item was removed:
- ----- Method: TimeStampTest>>testTimeStamp (in category 'testing') -----
- testTimeStamp
- 	self assert: aTimeStamp = aTimeStamp asTimeStamp
- !

Item was removed:
- ----- Method: TimeStampTest>>timestampClass (in category 'Private') -----
- timestampClass
- 
- 	^ TimeStamp!

Item was removed:
- ClassTestCase subclass: #TimeTest
- 	instanceVariableNames: 'time aTime localTimeZoneToRestore timeWithNanos localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !TimeTest commentStamp: '<historical>' prior: 0!
- This is the unit test for the class Time.
- 
- !

Item was removed:
- ----- Method: TimeTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ self timeClass!

Item was removed:
- ----- Method: TimeTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	 | deprecated private special primitives timing benchmarks |
- 
- 	deprecated := #().
- 	private := #( #print24:on: #print24:showSeconds:on: ).
- 	special := #( #< #= #new #printOn: #storeOn: ).
- 	primitives := #().
- 	timing := #( #millisecondClockValue #milliseconds:since: #millisecondsSince: ).
- 	benchmarks := #( #benchmarkMillisecondClock #benchmarkPrimitiveResponseDelay ). 
- 
- 	^ super selectorsToBeIgnored, deprecated, private, special, primitives, timing, benchmarks.!

Item was removed:
- ----- Method: TimeTest>>setUp (in category 'Running') -----
- setUp
- 
- 	localTimeZoneToRestore := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	DateAndTime localTimeZone: TimeZone default.
- 	time := self timeClass fromSeconds: 14567.		"4:02:47 am"
- 	aTime := self timeClass readFrom: '12:34:56 pm' readStream.
- 	timeWithNanos := self timeClass fromSeconds: 14567.42.
- !

Item was removed:
- ----- Method: TimeTest>>tearDown (in category 'Running') -----
- tearDown
- 	DateAndTime localTimeZone: localTimeZoneToRestore.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-  !

Item was removed:
- ----- Method: TimeTest>>testAccessing (in category 'Tests') -----
- testAccessing
- 
- 	self
- 		assert: time hours = 4;
- 		assert: time minutes = 2;
- 		assert: time seconds = 47;
- 		assert: time asSeconds = 14567.
- !

Item was removed:
- ----- Method: TimeTest>>testAddSeconds (in category 'testing') -----
- testAddSeconds
- 	self assert: (aTime addSeconds: 1) = (Time readFromString: '12:34:57').
- 	self assert: (aTime addSeconds: 60) = (Time readFromString: '12:35:56').	
- 	self assert: (aTime addSeconds: 3600) = (Time readFromString: '13:34:56').
- 	self assert: (aTime addSeconds: 24*60*60) = (Time readFromString: '12:34:56').!

Item was removed:
- ----- Method: TimeTest>>testAddSecondsNanoSecondRollover (in category 'testing') -----
- testAddSecondsNanoSecondRollover
- 
- 	| time1 time2 time3 time4 time5 time6 time7 time8 |
- 	time1 := Time fromSeconds: 1.2s.
- 	time2 := time1 addSeconds: 1.3s.
- 	"n.b. use ticks second to access seconds instvar because #asSeconds is
- 	questionable and possibly subject to future change -dtl" 
- 	self assert: 2 equals: time2 ticks second.
- 	self assert: 500000000 equals: time2 nanoSecond.
- 	time3 := Time fromSeconds: 1.9s.
- 	time4 := time3 addSeconds: 1.2s.
- 	self assert: 3 equals: time4 ticks second.
- 	self assert: 100000000 equals: time4 nanoSecond.
- 	time5 := Time fromSeconds: 0.9s.
- 	time6 := time5 addSeconds: 0.2s.
- 	self assert: 1 equals: time6 ticks second.
- 	self assert: 100000000 equals: time6 nanoSecond.
- 	time7 := time5 addSeconds: 1.
- 	self assert: 1 equals: time7 ticks second.
- 	self assert: 900000000 equals: time7 nanoSecond.
- 	"midnight rollover"
- 	time8 := '11:59:59.505 pm' asTime addSeconds: 1.0101.
- 	self assert: 0 equals: time8 ticks second.
- 	self assert: 515100000 equals: time8 nanoSecond.
- !

Item was removed:
- ----- Method: TimeTest>>testAddSecondsWithNanos (in category 'testing') -----
- testAddSecondsWithNanos
- 	self assert: (timeWithNanos addSeconds: 1) = (Time readFromString: '4:02:48.42 am').
- 	self assert: (timeWithNanos addSeconds: 60) = (Time readFromString: '4:03:47.42 am').	
- 	self assert: (timeWithNanos addSeconds: 3600) = (Time readFromString: '5:02:47.42 am').
- 	self assert: (timeWithNanos addSeconds: 24*60*60) = (Time readFromString: '4:02:47.42 am').
- 	"rollover after midnight"
- 	self assert: (timeWithNanos addSeconds: 71832) = (Time readFromString: '11:59:59.42 pm').
- 	self assert: (timeWithNanos addSeconds: 71833) = (Time readFromString: '00:00:00.42 am').
- !

Item was removed:
- ----- Method: TimeTest>>testAddTime (in category 'testing') -----
- testAddTime
- 	self assert: (aTime addTime: aTime) = (Time readFromString: '01:09:52').
- !

Item was removed:
- ----- Method: TimeTest>>testArithmetic (in category 'Tests') -----
- testArithmetic
- 	| t1 t2 t3 |
- 	t1 := time addSeconds: 70.		"4:03:57 am"
- 	self
- 		assert: t1 hours = 4;
- 		assert: t1 minutes = 3;
- 		assert: t1 seconds = 57.
- 
- 	t2 := t1 addTime: (self timeClass fromSeconds: (60*60*5)).
- 	self
- 		assert: t2 hours = 9;
- 		assert: t2 minutes = 3;
- 		assert: t2 seconds = 57.
- 
- 	t3 := t2 subtractTime: (self timeClass fromSeconds: (60*60*5) + 70).
- 	self
- 		assert: t3 = time.
- !

Item was removed:
- ----- Method: TimeTest>>testAsDate (in category 'testing') -----
- testAsDate
- 	self assert: (aTime asDate) = (Date current)
- !

Item was removed:
- ----- Method: TimeTest>>testAsDateAndTime (in category 'testing') -----
- testAsDateAndTime
- 	self assert: (aTime asDateAndTime) = (DateAndTime current midnight + aTime)
- !

Item was removed:
- ----- Method: TimeTest>>testAsDuration (in category 'testing') -----
- testAsDuration
- 	self assert: (aTime asDuration) = (Duration days: 0 hours: 12 minutes: 34 seconds: 56)
- !

Item was removed:
- ----- Method: TimeTest>>testAsNanoSeconds (in category 'testing') -----
- testAsNanoSeconds
- 	self assert: (aTime asNanoSeconds) = 45296000000000
- 
- !

Item was removed:
- ----- Method: TimeTest>>testAsSeconds (in category 'testing') -----
- testAsSeconds
- 	self assert: (aTime asSeconds) = 45296
- !

Item was removed:
- ----- Method: TimeTest>>testAsTime (in category 'testing') -----
- testAsTime
- 	self assert: (aTime asTime) = aTime
- 
- !

Item was removed:
- ----- Method: TimeTest>>testAsTimeStamp (in category 'testing') -----
- testAsTimeStamp
- 	self assert: (aTime asTimeStamp) = (DateAndTime current midnight + aTime) asTimeStamp
- !

Item was removed:
- ----- Method: TimeTest>>testAsWeek (in category 'testing') -----
- testAsWeek
- 	self assert: aTime asWeek = (DateAndTime current midnight + aTime) asWeek
- !

Item was removed:
- ----- Method: TimeTest>>testAsYear (in category 'testing') -----
- testAsYear
- 	self assert: aTime asYear = (DateAndTime current midnight + aTime) asYear
- !

Item was removed:
- ----- Method: TimeTest>>testComparing (in category 'Tests') -----
- testComparing
- 	| t1 t2 t3 |
- 	t1 := self timeClass fromSeconds: 14567.		"4:02:47 am"
- 	t2 := self timeClass fromSeconds: 5000.		"1:23:20 am"
- 	t3 := self timeClass fromSeconds: 80000.		"10:13:20 pm"
- 
- 	self
- 		assert: time = t1;
- 		assert: time hash = t1 hash;
- 		assert: time = time copy.
- 	self
- 		deny: t1 < t2;
- 		assert: t1 < t3.!

Item was removed:
- ----- Method: TimeTest>>testConverting (in category 'Tests') -----
- testConverting
- 
- 	self
- 		assert: time asSeconds = 14567.!

Item was removed:
- ----- Method: TimeTest>>testDuration (in category 'testing') -----
- testDuration
- 	self assert: aTime duration = 0 seconds!

Item was removed:
- ----- Method: TimeTest>>testEqual (in category 'testing') -----
- testEqual
- 	self assert: aTime = (Time readFromString: '12:34:56').!

Item was removed:
- ----- Method: TimeTest>>testFromSeconds (in category 'Tests') -----
- testFromSeconds
- 	| t |
- 	t := self timeClass fromSeconds: 14567.
- 	self
- 		assert: t = time
- !

Item was removed:
- ----- Method: TimeTest>>testGeneralInquiries (in category 'Tests') -----
- testGeneralInquiries
- 	| now d t dt epsilon |
- 
- 	"vm clocks seem to work differently across platforms, so an epsilon is required"
- 	epsilon := 1. "second"
- 	now  := self timeClass dateAndTimeNow.
- 	self 
- 		assert: now size = 2;
- 		assert: (now last asSeconds - self timeClass now asSeconds) abs <= epsilon.
- 
- 	self should: [ self timeClass timeWords ] raise: MessageNotUnderstood.
- 
- 	d := '2 June 1973' asDate.
- 	t := '4:02:47 am' asTime.
- 	dt := self timeClass dateAndTimeFromSeconds: (2285280000 + 14567).
- 	self
- 		assert: dt = {d. t.}.
- !

Item was removed:
- ----- Method: TimeTest>>testHash (in category 'testing') -----
- testHash
- 	self assert: aTime hash = (Character instSize > 0 ifTrue: [607004] ifFalse: [101409191])!

Item was removed:
- ----- Method: TimeTest>>testHhmm24 (in category 'testing') -----
- testHhmm24
- 	self assert: aTime hhmm24 = '1234'!

Item was removed:
- ----- Method: TimeTest>>testHour (in category 'testing') -----
- testHour
- 	self assert: aTime hour =  12.
- 	self assert: aTime hour12 =  12.
- 	self assert: aTime hour24 =  12.
- 	self assert: aTime hours =  12.!

Item was removed:
- ----- Method: TimeTest>>testHumanWordsForSecondsAgo (in category 'testing') -----
- testHumanWordsForSecondsAgo
- 	self assert: (Time humanWordsForSecondsAgo: 0.999999999)
- 			= 'a second ago'.
- 	self assert: (Time humanWordsForSecondsAgo: 44.99999999)
- 			= '44.99999999 seconds ago'.
- 	self assert: (Time humanWordsForSecondsAgo: 89.999999999)
- 			= 'a minute ago'.
- 	self assert: (Time humanWordsForSecondsAgo: 2699.999999999)
- 			= '44 minutes ago'.
- 	self assert: (Time humanWordsForSecondsAgo: 5399.999999999)
- 			= 'an hour ago'.
- 	self assert: (Time humanWordsForSecondsAgo: 64799.999999999)
- 			= '17 hours ago'.
- 	!

Item was removed:
- ----- Method: TimeTest>>testHumanWordsForSecondsAgoWithDays (in category 'testing') -----
- testHumanWordsForSecondsAgoWithDays
- 
- 	self assert: (Time humanWordsForSecondsAgo: 18 * 60 * 60)
- 					= 'yesterday'.
- 	self assert: (Time humanWordsForSecondsAgo: 24 * 60 * 60)
- 					= 'yesterday'.
- !

Item was removed:
- ----- Method: TimeTest>>testLessThan (in category 'testing') -----
- testLessThan
- 	self assert: aTime < (Time readFromString: '12:34:57').!

Item was removed:
- ----- Method: TimeTest>>testMeridianAbbreviation (in category 'testing') -----
- testMeridianAbbreviation
- 	self assert: aTime meridianAbbreviation =  'PM'.
- !

Item was removed:
- ----- Method: TimeTest>>testMinute (in category 'testing') -----
- testMinute
- 	self assert: aTime minute =  34.
- 	self assert: aTime minutes =  34
- !

Item was removed:
- ----- Method: TimeTest>>testNanoSecond (in category 'testing') -----
- testNanoSecond
- 	self assert: aTime nanoSecond = 0
- 	"Right now all times all seconds"
- !

Item was removed:
- ----- Method: TimeTest>>testNew (in category 'Tests') -----
- testNew
- 	
- 	self assert: self timeClass new asSeconds = 0!

Item was removed:
- ----- Method: TimeTest>>testPrint24 (in category 'testing') -----
- testPrint24
- 	self assert: aTime print24 = '12:34:56'!

Item was removed:
- ----- Method: TimeTest>>testPrint24On (in category 'testing') -----
- testPrint24On
- 	| referenceString printed |
- 	referenceString := '12:34:56'.
- 	printed := WriteStream on: ''.
- 	aTime print24: true on: printed.
- 	self assert: printed contents = referenceString!

Item was removed:
- ----- Method: TimeTest>>testPrint24OnWithPM (in category 'testing') -----
- testPrint24OnWithPM
- 	| referenceString printed |
- 	referenceString := '12:34:56 pm'.
- 	printed := WriteStream on: ''.
- 	aTime print24: false on: printed.
- 	^ self assert: printed contents = referenceString!

Item was removed:
- ----- Method: TimeTest>>testPrint24OnWithoutSeconds (in category 'testing') -----
- testPrint24OnWithoutSeconds
- 	| referenceString printed |
- 	referenceString := '12:34'.
- 	printed := WriteStream on: ''.
- 	aTime print24: true showSeconds: false on: printed.
- 	self assert: printed contents = referenceString!

Item was removed:
- ----- Method: TimeTest>>testPrintMinutes (in category 'testing') -----
- testPrintMinutes
- 	self assert: aTime printMinutes = '12:34 pm'!

Item was removed:
- ----- Method: TimeTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| referenceString printed |
- 	referenceString := '12:34:56 pm'.
- 	printed := WriteStream on: ''.
- 	aTime printOn: printed.
- 	self assert: printed contents = referenceString!

Item was removed:
- ----- Method: TimeTest>>testPrinting (in category 'Tests') -----
- testPrinting
- 
- 	self	
- 		assert: time printString = '4:02:47 am';
- 		assert: time intervalString =  '4 hours 2 minutes 47 seconds';
- 		assert: time print24 = '04:02:47';
- 		assert: time printMinutes = '4:02 am';
- 		assert: time hhmm24 = '0402'.
- !

Item was removed:
- ----- Method: TimeTest>>testPrintingNanos (in category 'Tests') -----
- testPrintingNanos
- 
- 	self	
- 		assert: timeWithNanos printString = '4:02:47.42 am';
- 		assert: timeWithNanos intervalString =  '4 hours 2 minutes 47 seconds';
- 		assert: timeWithNanos print24 = '04:02:47';
- 		assert: timeWithNanos printMinutes = '4:02 am';
- 		assert: timeWithNanos hhmm24 = '0402'.
- !

Item was removed:
- ----- Method: TimeTest>>testReadFrom (in category 'Tests') -----
- testReadFrom
- 
- 	| t1 t2 |
- 	t1 := self timeClass readFrom: '4:02:47 am' readStream.
- 	t2 := self timeClass readFrom: '4:02:47.000 am' readStream.
- 
- 	self
- 		assert: time = t1;
- 		assert: time = t2
- !

Item was removed:
- ----- Method: TimeTest>>testSecond (in category 'testing') -----
- testSecond
- 	self assert: aTime second =  56.
- 	self assert: aTime seconds =  56
- !

Item was removed:
- ----- Method: TimeTest>>testSqueakInquiries (in category 'Tests') -----
- testSqueakInquiries
- 	| timewords totalseconds condensed corrected |
- 	self assert: 
- 		(self timeClass namesForTimes: #(2 10000023 10000026))
- 			= #('January, 1901' 'April, 1901, 4/26/1901, 5:47 pm' 'April, 1901, 4/26/1901, 5:47 pm').
- 
- 	timewords := #(0.5 30 62 130 4000 10000 60000 86401) 
- 		collect: [ :ss | self timeClass humanWordsForSecondsAgo: ss ].
- 	self assert: 
- 		timewords = #('a second ago' '30 seconds ago' 'a minute ago' '2 minutes ago' 
- 			'an hour ago' '2 hours ago' '16 hours ago' 'yesterday').
- 
- 	totalseconds :=  self timeClass totalSeconds.
- 	condensed := self timeClass condenseBunches: 
- 		(#(20 400 401  20000 20200 20300 40000 45000  200000 201000 202000) 
- 			collect: [:tt | totalseconds - tt]).
- 	corrected := condensed collect: [ :e | totalseconds - e ].
- 	self
- 		assert: (corrected includesAllOf: #(20 400 401 20000 40000 45000 200000)).
- !

Item was removed:
- ----- Method: TimeTest>>testStoreOn (in category 'testing') -----
- testStoreOn
- 	| referenceString stored |
- 	referenceString := '''12:34:56 pm'' asTime'.
- 	stored := WriteStream on: ''.
- 	aTime storeOn: stored.
- 	self assert: stored contents = referenceString!

Item was removed:
- ----- Method: TimeTest>>testStoring (in category 'Tests') -----
- testStoring
- 
- 	self	
- 		assert: time storeString = '''4:02:47 am'' asTime';
- 		assert: time = ('4:02:47 am' asTime).
- !

Item was removed:
- ----- Method: TimeTest>>testSubtractTime (in category 'testing') -----
- testSubtractTime
- 	self assert: (aTime subtractTime: aTime) = (Time readFrom: (ReadStream on: '00:00:00'))
- !

Item was removed:
- ----- Method: TimeTest>>testTicks (in category 'testing') -----
- testTicks
- 	self assert: aTime ticks = #(0 45296 0).
- 	self assert: aTime  = (Time new ticks: #(0 45296 0))!

Item was removed:
- ----- Method: TimeTest>>testTimeStamp (in category 'testing') -----
- testTimeStamp
- 	self assert: aTime = aTime asTimeStamp asTime!

Item was removed:
- ----- Method: TimeTest>>timeClass (in category 'Private') -----
- timeClass
- 
- 	^ Time!

Item was removed:
- TestCase subclass: #TimespanDoSpanAYearTest
- 	instanceVariableNames: 'aTimespan aDuration aDate'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !TimespanDoSpanAYearTest commentStamp: 'tlk 1/6/2004 17:55' prior: 0!
- I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndTimeEpochTestCase for a complete list. tlk.
- My fixtures include a Timespan that crosses over a year boundary:
- aDate = December 25, 2004, midnight
- aDuration = 91 days
- aTimeSpan= 91 days, starting December 25, 2004, midnight!

Item was removed:
- ----- Method: TimespanDoSpanAYearTest>>setUp (in category 'running') -----
- setUp
- 	aDate := DateAndTime year: 2004 month: 12 day: 25 hour: 0 minute: 0 second: 0.
- 	aDuration := Duration days: 91 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0.
- 
- 	aTimespan := Timespan starting: aDate duration: aDuration!

Item was removed:
- ----- Method: TimespanDoSpanAYearTest>>testMonthsDo (in category 'testing') -----
- testMonthsDo
- 
- 	| monthArray |
- 
- 	monthArray := Array
- 				with: (Month starting: (DateAndTime year: 2004 day: 355) duration: 31 days)
- 				with: (Month starting: (DateAndTime year: 2005 day: 1) duration: 31 days)
- 				with: (Month starting: (DateAndTime year: 2005 day: 32) duration: 29 days)
- 				with: (Month starting: (DateAndTime year: 2005 day: 61) duration: 31 days).
- 				
- 	self assert: aTimespan months = monthArray!

Item was removed:
- ----- Method: TimespanDoSpanAYearTest>>testNext (in category 'testing') -----
- testNext
- 
- 	self assert: aTimespan next
- 			= (Timespan
- 					starting: (DateAndTime
- 							year: 2005
- 							month: 3
- 							day: 26
- 							hour: 0
- 							minute: 0
- 							second: 0)
- 					duration: aDuration)!

Item was removed:
- ----- Method: TimespanDoSpanAYearTest>>testWeeksDo (in category 'testing') -----
- testWeeksDo
- 	| weeks weekArray |
- 	weeks := aTimespan weeks.
- 	self assert: weeks size = ((aDuration days / 7.0) ceiling + 1).
- 
- 	weekArray := OrderedCollection new.
- 	weekArray
- 		addLast: (Week starting: (DateAndTime year: 2004 month: 12 day: 19) duration: 7 days);
- 		addLast: (Week starting: (DateAndTime year: 2004 month: 12 day: 26) duration: 7 days).
- 
- 	2 to: 79 by: 7 do:
- 		[ :i | weekArray
- 				addLast: (Week starting: (DateAndTime year: 2005 day: i) duration: 7 days) ].
- 
- 	weekArray := weekArray asArray.
- 	self assert: aTimespan weeks = weekArray
- !

Item was removed:
- ----- Method: TimespanDoSpanAYearTest>>testYearsDo (in category 'testing') -----
- testYearsDo
- 	| yearArray |
- 	yearArray := Array
- 				with: (Year
- 						starting: (DateAndTime
- 								year: 2004
- 								month: 12
- 								day: 25)
- 						duration: 366 days).
- 	self assert: aTimespan years = yearArray
- !

Item was removed:
- TestCase subclass: #TimespanDoTest
- 	instanceVariableNames: 'aTimespan aDuration aDate'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !TimespanDoTest commentStamp: 'tlk 1/6/2004 17:55' prior: 0!
- I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndTimeEpochTestCase for a complete list.  tlk.
- My fixtures are:
- aDate = January 8, 2003, midnight
- aDuration = 91 days
- aTimeSpan= 91 days, starting January 8, 2003, midnight
- !

Item was removed:
- ----- Method: TimespanDoTest>>setUp (in category 'running') -----
- setUp
- 	aDate := DateAndTime
- 				year: 2003
- 				month: 01
- 				day: 07
- 				hour: 0
- 				minute: 0
- 				second: 0.
- 	aDuration := Duration
- 				days: 91
- 				hours: 0
- 				minutes: 0
- 				seconds: 0
- 				nanoSeconds: 0.
- 	aTimespan := Timespan starting: aDate makeUTC duration: aDuration!

Item was removed:
- ----- Method: TimespanDoTest>>testDatesDo (in category 'testing') -----
- testDatesDo
- 	| dateArray |
- 	dateArray := OrderedCollection new.
- 	7
- 		to: 97
- 		do: [:each | dateArray
- 				addLast: (Date year: 2003 day: each)].
- 	dateArray := dateArray asArray.
- 	self assert: aTimespan dates = dateArray!

Item was removed:
- ----- Method: TimespanDoTest>>testDoWith (in category 'testing') -----
- testDoWith
- 	| count |
- 	count := 0.
- 	aTimespan
- 		do: [:each | count := count + 1]
- 		with: (Timespan
- 				starting: aDate
- 				duration: 7 days).
- 	self assert: count = 13!

Item was removed:
- ----- Method: TimespanDoTest>>testDoWithWhen (in category 'testing') -----
- testDoWithWhen
- 	| count |
- 	count := 0.
- 	aTimespan
- 		do: [:each | count := count + 1]
- 		with: (Timespan starting: aDate duration: 7 days)
- 		when: [:each | count < 5].
- 	self assert: count = 5	
- !

Item was removed:
- ----- Method: TimespanDoTest>>testEveryDo (in category 'testing') -----
- testEveryDo
- 	|count  duration |
- 	count := 0.
- 	duration := 7 days.
- 	(aTimespan
- 			every: duration
- 			do: [:each | count := count + 1]).
- 	self assert: count = 13
- 			!

Item was removed:
- ----- Method: TimespanDoTest>>testMonthsDo (in category 'testing') -----
- testMonthsDo
- 	| monthArray |
- 	monthArray := Array
- 				with: (Month
- 						starting: (DateAndTime year: 2003 day: 1 hour: 0 minute: 0 second: 0 offset: Month defaultOffset)
- 						duration: 31 days)
- 				with: (Month
- 						starting: (DateAndTime year: 2003 day: 32 hour: 0 minute: 0 second: 0 offset: Month defaultOffset)
- 						duration: 28 days)
- 				with: (Month
- 						starting: (DateAndTime year: 2003 day: 60 hour: 0 minute: 0 second: 0 offset: Month defaultOffset)
- 						duration: 31 days)		
- 				with: (Month
- 						starting: (DateAndTime year: 2003 day: 91 hour: 0 minute: 0 second: 0 offset: Month defaultOffset)
- 						duration: 30 days).
- 	self assert: aTimespan months = monthArray!

Item was removed:
- ----- Method: TimespanDoTest>>testNext (in category 'testing') -----
- testNext
- 	self assert: aTimespan next 
- 			= (Timespan
- 					starting: (DateAndTime
- 							year: 2003
- 							month: 4
- 							day: 8
- 							hour: 0
- 							minute: 0
- 							second: 0 
- 							offset: Timespan defaultOffset)
- 					duration: aDuration)!

Item was removed:
- ----- Method: TimespanDoTest>>testWeeksDo (in category 'testing') -----
- testWeeksDo
- 	| weekArray |
- 	weekArray := OrderedCollection new.
- 	7
- 		to: 98
- 		by: 7
- 		do: [:each | weekArray
- 				addLast: (Week
- 						starting: (DateAndTime year: 2003 day: each hour: 0 minute: 0 second: 0 offset: Week defaultOffset)
- 						duration: 7 days)].
- 	weekArray := weekArray asArray.
- 	self assert: aTimespan weeks = weekArray
- !

Item was removed:
- ----- Method: TimespanDoTest>>testYearsDo (in category 'testing') -----
- testYearsDo
- 	| yearArray |
- 	yearArray := Array
- 				with: (Year
- 						starting: (DateAndTime year: 2003 day: 7 hour: 0 minute: 0 second: 0 offset: Year defaultOffset)
- 						duration: 365 days).
- 	self assert: aTimespan years contents = yearArray contents!

Item was removed:
- ClassTestCase subclass: #TimespanTest
- 	instanceVariableNames: 'timespan aTimespan anOverlappingTimespan anIncludedTimespan aDisjointTimespan aDay aWeek dec31 jan01 jan08 localTimeZoneToRestore anEqualTimeSpan localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: TimespanTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Timespan
- !

Item was removed:
- ----- Method: TimespanTest>>setUp (in category 'Running') -----
- setUp
- 
- 	| jan01HereSomeWhereElseOnEarth |
- 	localTimeZoneToRestore := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	DateAndTime localTimeZone: TimeZone default.
- 
- 	"100 hours starting noon 22 March 2003"
- 	timespan := Timespan starting:
- 					(DateAndTime year: 2003 month: 03 day: 22 hour: 12 minute: 0 second: 0)
- 						duration: (Duration hours: 100).
- 
- 	dec31 := (DateAndTime year: 2004 month: 12 day: 31 hour: 0 minute: 0 second: 0).
- 	jan01 := (DateAndTime year: 2005 month: 1 day: 1 hour: 0 minute: 0 second: 0).
- 	jan08 := (DateAndTime year: 2005 month: 1 day: 8 hour: 0 minute: 0 second:0).
- 	aDay := Duration days: 1 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0.
- 	aWeek := Duration days: 7 hours: 0 minutes: 0 seconds: 0 nanoSeconds: 0.
- 	aTimespan := Timespan starting: jan01 duration: aWeek.
- 	jan01HereSomeWhereElseOnEarth := DateAndTime new ticks: (jan01 + 3 hours) ticks offset: jan01 offset + 3 hours.
- 	anEqualTimeSpan := Timespan starting: jan01HereSomeWhereElseOnEarth asUTC duration: aWeek.
- 	anOverlappingTimespan := Timespan starting: dec31 duration: aWeek.
- 	anIncludedTimespan := Timespan starting: jan01 duration: aDay.
- 	aDisjointTimespan := Timespan starting: jan08 duration: aWeek.
- 
- 
- 
- !

Item was removed:
- ----- Method: TimespanTest>>tearDown (in category 'Running') -----
- tearDown
- 	DateAndTime localTimeZone: localTimeZoneToRestore.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.
-  	timespan := nil
- !

Item was removed:
- ----- Method: TimespanTest>>testAccessing (in category 'Tests') -----
- testAccessing
- 
- 	self 
- 		assert: (timespan start =
- 				 (DateAndTime year: 2003 month: 03 day: 22 hour: 12 minute: 0 second: 0));
- 		assert: timespan duration = (Duration hours: 100);
- 		assert: timespan month = 3;
- 		assert: timespan monthName = 'March';
- 		assert: timespan monthAbbreviation = 'Mar'
- 		
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testArithmetic (in category 'Tests') -----
- testArithmetic
- 
- 	| ts1 ts2 d |
- 	ts1 := timespan + 2 days.
- 	ts2 := ts1 - 2 days.
- 	d := ts1 - (DateAndTime year: 2003 month: 03 day: 20).
- 
- 	self 
- 		assert: (ts1 start = 
- 				 (DateAndTime year: 2003 month: 03 day: 24 hour: 12 minute: 0 second: 0));
- 		assert: (ts1 duration = timespan duration);
- 		assert: (ts2 start = timespan start);
- 		assert: (ts2 duration = timespan duration).
- 
- 	self
- 		assert: d = (Duration days: 4 hours: 12 minutes: 0 seconds: 0)
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testAsDate (in category 'testing') -----
- testAsDate
- 	self assert: aTimespan asDate =   jan01 asDate.
- 	"MessageNotUnderstood: Date class>>starting:"
- !

Item was removed:
- ----- Method: TimespanTest>>testAsDateAndTime (in category 'testing') -----
- testAsDateAndTime
- 	self assert: aTimespan asDateAndTime =   jan01.
- 	"MessageNotUnderstood: Date class>>starting:"
- 	
- !

Item was removed:
- ----- Method: TimespanTest>>testAsDuration (in category 'testing') -----
- testAsDuration
- 	self assert: aTimespan asDuration =  aWeek.
- 
- 	
- 	
- !

Item was removed:
- ----- Method: TimespanTest>>testAsMonth (in category 'testing') -----
- testAsMonth
- 	self assert: aTimespan asMonth =   jan01 asMonth.
- !

Item was removed:
- ----- Method: TimespanTest>>testAsTime (in category 'testing') -----
- testAsTime
- 	self assert: aTimespan asTime =  jan01 asTime
- 	"MessageNotUnderstood: Time class>>seconds:nanoSeconds:"
-  !

Item was removed:
- ----- Method: TimespanTest>>testAsTimeStamp (in category 'testing') -----
- testAsTimeStamp
- 	self assert: aTimespan asTimeStamp =  ((TimeStamp readFrom: '1-01-2005 0:00 am' readStream) offset: 0 hours).
- !

Item was removed:
- ----- Method: TimespanTest>>testAsWeek (in category 'testing') -----
- testAsWeek
- 	self assert: aTimespan asWeek =   jan01 asWeek.
- 	"DateAndTime new asWeek
- 	 MessageNotUnderstood: Week class>>starting:"
- !

Item was removed:
- ----- Method: TimespanTest>>testAsYear (in category 'testing') -----
- testAsYear
- 	self assert: aTimespan asYear =   jan01 asYear.
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testBeCanonical (in category 'Tests') -----
- testBeCanonical
- 
- 	| start ts1 ts2 ts3 |
- 	start := '2019-01-27T17:11:40.061188-05:00' asDateAndTime.
- 	ts1 := Timespan starting: start duration: 123456 seconds.
- 	ts2 := ts1 deepCopy.
- 	ts3 := ts2 beCanonical.
- 	self assert: ts2
- 		identical: ts3
- 		description: 'beCanonical modifies the receiver, not a copy thereof'.
- 	self deny: ts3 = ts1.
- 	self assert: '2019-01-27T17:11:40.061188-05:00' asDateAndTime
- 		equals: ts1 start
- 		description: 'original timespan start is not modified'.
- 	self assert: ts1 duration
- 		equals: ts3 duration
- 		description: 'duration does not change'.
- 	self assert: '2019-01-27T17:11:40.061188+00:00' asDateAndTime
- 		equals: ts3 start.
- 	self deny: ts1 start = ts3 start
- 		description: 'magnitude of start time is changed'.
- 	self assert: 5 hours
- 		equals: start - ts3 start
- 		description: 'magnitude of start time is changed'.
- 	self assert: 0 seconds
- 		equals: ts3 start offset
- 		description: 'time zone offset is zero'.
- 	self assert: 5 hours negated
- 		equals: ts1 start offset
- 		description: 'original timezone was -18000'.
- !

Item was removed:
- ----- Method: TimespanTest>>testClockPrecisionDuration (in category 'testing') -----
- testClockPrecisionDuration
- 	| ts |
- 	ts := Timespan starting: Date today duration: DateAndTime clockPrecision.
- 	self
- 		assert: ts start = ts end!

Item was removed:
- ----- Method: TimespanTest>>testCurrent (in category 'testing') -----
- testCurrent
- 	self assert: (Timespan starting: DateAndTime current)
- 			<= Timespan current.
- 	self assert:  Timespan current
- 			<= (Timespan starting: DateAndTime current)!

Item was removed:
- ----- Method: TimespanTest>>testDateToday (in category 'testing') -----
- testDateToday
- 	self assert: Date today start offset isZero!

Item was removed:
- ----- Method: TimespanTest>>testDay (in category 'testing') -----
- testDay
- 	self assert: aTimespan day =   jan01 day
- !

Item was removed:
- ----- Method: TimespanTest>>testDayOfMonth (in category 'testing') -----
- testDayOfMonth
- 	self assert: aTimespan dayOfMonth  = 1.
- !

Item was removed:
- ----- Method: TimespanTest>>testDayOfWeek (in category 'testing') -----
- testDayOfWeek
- 	self assert: aTimespan  dayOfWeek  = 7.
- 	self assert: aTimespan  dayOfWeekName = 'Saturday'.
- !

Item was removed:
- ----- Method: TimespanTest>>testDayOfYear (in category 'testing') -----
- testDayOfYear
- 	self assert: aTimespan  dayOfYear  = 1.
- 	"MessageNotUnderstood: UndefinedObject>>year:, Undefined object is Year class"
- !

Item was removed:
- ----- Method: TimespanTest>>testDaysInMonth (in category 'testing') -----
- testDaysInMonth
- 	self assert: aTimespan  daysInMonth  = 31.
- 	"MessageNotUnderstood: Month class>>starting:"
- !

Item was removed:
- ----- Method: TimespanTest>>testDaysInYear (in category 'testing') -----
- testDaysInYear
- 	self assert: aTimespan  daysInYear  = 365.
- 	"MessageNotUnderstood: UndefinedObject>>starting:  UndefinedObject is Year class"
- !

Item was removed:
- ----- Method: TimespanTest>>testDaysLeftInYear (in category 'testing') -----
- testDaysLeftInYear
- 	self assert: aTimespan  daysLeftInYear  = 364.
- 	"MessageNotUnderstood: UndefinedObject>>starting:  UndefinedObject is Year class"
- !

Item was removed:
- ----- Method: TimespanTest>>testDoWith (in category 'testing') -----
- testDoWith
- 	| count |
- 	count := 0.
- 	aTimespan
- 		do: [:each | count := count + 1]
- 		with: (Timespan starting: jan01 duration: aDay).
- 	self assert: count = 7!

Item was removed:
- ----- Method: TimespanTest>>testDoWithWhen (in category 'testing') -----
- testDoWithWhen
- 	| count |
- 	count := 0.
- 	aTimespan
- 		do: [:each | count := count + 1]
- 		with: (Timespan starting: jan01 duration: aDay)
- 		when: [:each | count < 5].
- 	self assert: count = 5!

Item was removed:
- ----- Method: TimespanTest>>testDuration (in category 'testing') -----
- testDuration
- 	self assert: aTimespan duration  = aWeek.
- 	aTimespan duration: aDay.
- 	self assert: aTimespan duration =  aDay.
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testEnd (in category 'testing') -----
- testEnd
- 	self assert: aTimespan end + (Duration  nanoSeconds:1)  =  aDisjointTimespan start.
- 	self assert: aTimespan end = (DateAndTime year: 2005 month: 1 day: 7 hour: 23 minute: 59 second: 59 nanoSecond: 999999999 offset: 0 hours)
- !

Item was removed:
- ----- Method: TimespanTest>>testEveryDo (in category 'testing') -----
- testEveryDo
- 	| count duration |
- 	count := 0.
- 	duration := 7 days.
- 	aTimespan
- 		every: duration
- 		do: [:each | count := count + 1].
- 	self assert: count = 1!

Item was removed:
- ----- Method: TimespanTest>>testFirstDayOfMonth (in category 'testing') -----
- testFirstDayOfMonth
- 	self assert: aTimespan firstDayOfMonth =   1. 
- 	self assert: aDisjointTimespan firstDayOfMonth =   1
- !

Item was removed:
- ----- Method: TimespanTest>>testHash (in category 'testing') -----
- testHash
- 	self assert: (aTimespan = anEqualTimeSpan) ==> [aTimespan hash = anEqualTimeSpan hash]!

Item was removed:
- ----- Method: TimespanTest>>testIncludes (in category 'testing') -----
- testIncludes
- 	self assert: (aTimespan includes: jan01).
- 	self deny: (aTimespan includes: jan08)
- !

Item was removed:
- ----- Method: TimespanTest>>testIncludesAllOf (in category 'testing') -----
- testIncludesAllOf
- 	self assert: (aTimespan includesAllOf: (Bag with: jan01)).
- 	self deny: (aTimespan includesAllOf: (Bag with: jan01 with: jan08))
- !

Item was removed:
- ----- Method: TimespanTest>>testIncludesAnyOf (in category 'testing') -----
- testIncludesAnyOf
- 	self deny: (aTimespan includesAnyOf: (Bag with: dec31)).
- 	self assert: (aTimespan includesAnyOf: (Bag with: jan01 with: jan08))
- 	"Error is due to bug in Timespan 
- includesAnyOf: aCollection "
- 	"Answer whether any element of aCollection is included in the receiver"
- 	"aCollection do: [ :elem | (self includes: elem) ifTrue: [^ true]].
- Shouldn't this return false if none are included?
- "
- !

Item was removed:
- ----- Method: TimespanTest>>testInclusion (in category 'Tests') -----
- testInclusion
- 
- 	| t1 t2 t3 t4 |
- 	t1 := timespan start.
- 	t2 := timespan start + (timespan duration / 2).
- 	t3 := timespan end.
- 	t4 := timespan start + (timespan duration).
- 
- 	self 
- 		assert: (timespan includes: t1);
- 		assert: (timespan includes: t2);
- 		assert: (timespan includes: t3)";
- 		deny: (timespan includes: t4).
- 	self
- 		assert: (timespan includes: (t1 to: t2));
- 		assert: (timespan includes: (t1 to: t4));
- 		deny: (timespan includes: (Timespan starting: t2 duration: (timespan duration * 2))).
- 	self 
- 		assert: (timespan includesAllOf: { t1. t2. t3 } );
- 		deny: (timespan includesAllOf: { t1. t2. t3. t4} ).
- 	self 
- 		assert: (timespan includesAnyOf: { t1. t2. t3 } );
- 		deny: (timespan includesAnyOf: { t4 } ).
- "!

Item was removed:
- ----- Method: TimespanTest>>testIntersectionWithDisjoint (in category 'testing') -----
- testIntersectionWithDisjoint
- 	self assert: (aTimespan intersection: aDisjointTimespan) isNil.
- !

Item was removed:
- ----- Method: TimespanTest>>testIntersectionWithIncluded (in category 'testing') -----
- testIntersectionWithIncluded
- 	self assert: (aTimespan intersection: anIncludedTimespan)  = 
- 	(Timespan starting: jan01 duration: (Duration days: 0 hours: 23 minutes: 59 seconds: 59 nanoSeconds: 999999999)).		
- 	self deny: (aTimespan intersection: anIncludedTimespan)	= anIncludedTimespan
- !

Item was removed:
- ----- Method: TimespanTest>>testIntersectionWithOverlapping (in category 'testing') -----
- testIntersectionWithOverlapping
- 	self assert: (aTimespan intersection: anOverlappingTimespan)  = 
- 	(Timespan starting: jan01 duration: (Duration days: 5 hours: 23 minutes: 59 seconds: 59 nanoSeconds: 999999999)).		
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testIntersectionWithSelf (in category 'testing') -----
- testIntersectionWithSelf
- 	self assert: (aTimespan intersection: aTimespan)  = 
- 	(Timespan starting: jan01 duration: (Duration days: 6 hours: 23 minutes: 59 seconds: 59 nanoSeconds: 999999999)).		
- 	self deny: (aTimespan intersection: anIncludedTimespan)	= aTimespan
- !

Item was removed:
- ----- Method: TimespanTest>>testIntersectionWithSeparate (in category 'testing') -----
- testIntersectionWithSeparate
- 	self assert: (aTimespan intersection: aDisjointTimespan) isNil.
- 	self deny: (aTimespan intersection: anOverlappingTimespan) isNil.
- 	self assert: (aTimespan intersection: anIncludedTimespan)  = 
- 	(Timespan starting: jan01 duration: (Duration days: 0 hours: 23 minutes: 59 seconds: 59 nanoSeconds: 999999999)).		
- 	self deny: (aTimespan intersection: anIncludedTimespan)	= anIncludedTimespan
- !

Item was removed:
- ----- Method: TimespanTest>>testIsLeapYear (in category 'testing') -----
- testIsLeapYear
- 	"self assert: anOverlappingTimespan isLeapYear."
- 	"not sure why this fails"
- 	self deny: aTimespan isLeapYear
- !

Item was removed:
- ----- Method: TimespanTest>>testJulianDayNumber (in category 'testing') -----
- testJulianDayNumber
- 	self assert: aTimespan julianDayNumber =  (jan01 julianDayNumber).
- !

Item was removed:
- ----- Method: TimespanTest>>testLessThan (in category 'testing') -----
- testLessThan
- 	self assert: aTimespan  < aDisjointTimespan.
- 	self deny: anIncludedTimespan < aTimespan
- 	!

Item was removed:
- ----- Method: TimespanTest>>testMinusADateAndTime (in category 'testing') -----
- testMinusADateAndTime
- 	"It appears that subtracting a date from a Timespan gives you a duration = to the difference between the start of the timespan and the date "
- 	self assert: aTimespan - dec31 =  aDay.
- 	self assert: aDisjointTimespan - jan01 =  aWeek.
- 
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testMinusADuration (in category 'testing') -----
- testMinusADuration
- 	"It appears that subtracting a duration from a Timespan gives you a Timespan shifted by the duration"
- 	self assert: aTimespan - aDay =  anOverlappingTimespan.
- 	self assert: aDisjointTimespan - aWeek =  aTimespan.	
- 
- 
- !

Item was removed:
- ----- Method: TimespanTest>>testMonth (in category 'testing') -----
- testMonth
- 	self assert: aTimespan month  = 1.
- 	self assert: aTimespan monthName = 'January'.
- 	self assert: aTimespan monthIndex = 1.!

Item was removed:
- ----- Method: TimespanTest>>testNew (in category 'testing') -----
- testNew
- 	self assert: Timespan new = (Timespan starting: '01-01-1901' asDate)!

Item was removed:
- ----- Method: TimespanTest>>testNext (in category 'testing') -----
- testNext
- 	self assert: aTimespan next = aDisjointTimespan
- !

Item was removed:
- ----- Method: TimespanTest>>testPlus (in category 'testing') -----
- testPlus
- 	self assert: aTimespan + aWeek = aDisjointTimespan.
- 	self assert: anOverlappingTimespan + aDay = aTimespan.
- !

Item was removed:
- ----- Method: TimespanTest>>testPrevious (in category 'testing') -----
- testPrevious
- 	self assert: aTimespan  = aDisjointTimespan previous.
- 	self assert: aTimespan next previous = aTimespan 
- !

Item was removed:
- ----- Method: TimespanTest>>testPrintOn (in category 'testing') -----
- testPrintOn
- 	| ref ws |
- 	ref := 'a Timespan(2005-01-01T00:00:00+00:00D7:00:00:00)'.
- 	ws := '' writeStream.
- 	aTimespan printOn: ws.
- 	self assert: ws contents = ref
- !

Item was removed:
- ----- Method: TimespanTest>>testRematerializedDateComparison (in category 'testing') -----
- testRematerializedDateComparison
- 	"Tests whether comparison semantics are affected by serialization / rematerialization."
- 	| isItTrue date refStream rwstream | date := Date today.
- 	isItTrue := DateAndTime now asDate = date.
- 	self assert: (date = DateAndTime now asDate) = isItTrue.
- 	self assert: (DateAndTime now asDate = date) = isItTrue.
- 	rwstream := RWBinaryOrTextStream on: ByteArray new.
- 	refStream := ReferenceStream on: rwstream..
- 	refStream nextPut: date; close.
- 	rwstream position: 0.
- 	refStream := ReferenceStream on: rwstream.
- 	date := refStream next.
- 	refStream close.
- 	self assert: (date = DateAndTime now asDate) = isItTrue.
- 	self assert: (DateAndTime now asDate = date) = isItTrue.
- !

Item was removed:
- ----- Method: TimespanTest>>testStart (in category 'testing') -----
- testStart
- 	self assert: aTimespan start =   jan01.
- 	aTimespan start: jan08.
- 	self assert: aTimespan start =   jan08.!

Item was removed:
- ----- Method: TimespanTest>>testStartingEnding (in category 'testing') -----
- testStartingEnding
- 	self assert: aTimespan  = (Timespan starting: jan01 ending: jan08)
- !

Item was removed:
- ----- Method: TimespanTest>>testTo (in category 'testing') -----
- testTo
- 	self assert: (anIncludedTimespan to: jan08) = aTimespan 
- !

Item was removed:
- ----- Method: TimespanTest>>testUnion (in category 'Tests') -----
- testUnion
- 
- 	| union |
- 	union := timespan union: timespan.
- 	
- 	self 
- 		assert: (union start = timespan start);
- 		assert: (union duration = timespan duration)
- !

Item was removed:
- ----- Method: TimespanTest>>testUnionWithDisjoint (in category 'testing') -----
- testUnionWithDisjoint
- 
- 	self assert: (aTimespan union: aDisjointTimespan)  = 
- 		(Timespan starting: jan01 duration: (14 days)).	
- 			
- !

Item was removed:
- ----- Method: TimespanTest>>testUnionWithIncluded (in category 'testing') -----
- testUnionWithIncluded
- 
- 	self 
- 		assert: (aTimespan union: anIncludedTimespan) = aTimespan 	!

Item was removed:
- ----- Method: TimespanTest>>testUnionWithOverlapping (in category 'testing') -----
- testUnionWithOverlapping
- 
- 	self 
- 		assert: (aTimespan union: anOverlappingTimespan)  = 
- 				(Timespan starting: dec31 duration: (8 days))!

Item was removed:
- ----- Method: TimespanTest>>testUnionWithSelf (in category 'testing') -----
- testUnionWithSelf
- 	self assert: (aTimespan union: aTimespan) = aTimespan
- 	!

Item was removed:
- ----- Method: TimespanTest>>testUnionWithSeparate (in category 'testing') -----
- testUnionWithSeparate
- 
- 	self 
- 		assert: (anOverlappingTimespan union: aDisjointTimespan) = 
- 			(Timespan 
- 				starting: anOverlappingTimespan start
- 				ending:  (aDisjointTimespan end + DateAndTime clockPrecision))
- 			
- !

Item was removed:
- ----- Method: TimespanTest>>testWorkDatesDo (in category 'testing') -----
- testWorkDatesDo
- 	| count |
- 	count := 0.
- 	aTimespan
- 		workDatesDo: [:each | count := count + 1].
- 	self assert: count = 5!

Item was removed:
- ----- Method: TimespanTest>>testYear (in category 'testing') -----
- testYear
- 	self assert: aTimespan year = 2005.
- 
- 	!

Item was removed:
- ----- Method: TimespanTest>>testZeroDuration (in category 'testing') -----
- testZeroDuration
- 	| ts |
- 	ts := Timespan starting: Date today duration: Duration zero.
- 	self
- 		assert: ts start = ts end!

Item was removed:
- ClassTestCase subclass: #WeekTest
- 	instanceVariableNames: 'week restoredStartDay'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: WeekTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Week!

Item was removed:
- ----- Method: WeekTest>>selectorsToBeIgnored (in category 'Coverage') -----
- selectorsToBeIgnored
- 
- 	| deprecated private special |
- 
- 	deprecated := #().
- 	private := #( #printOn: ).
- 	special := #( #next #do: ).
- 
- 	^ super selectorsToBeIgnored, deprecated, private, special.!

Item was removed:
- ----- Method: WeekTest>>setUp (in category 'Running') -----
- setUp
- 	"June 1998, 5th week"
- 
- 	super setUp.
- 	restoredStartDay := Week startDay.
- 	Week startDay: #Sunday.
- 	week := Week starting: '4 July 1998' asDate!

Item was removed:
- ----- Method: WeekTest>>tearDown (in category 'Running') -----
- tearDown
- 
- 	super tearDown.
- 	Week startDay: restoredStartDay.
- 	week := nil.
- 
- !

Item was removed:
- ----- Method: WeekTest>>testDayNames (in category 'Tests') -----
- testDayNames
- 	self assert: (Week dayNames) = #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).!

Item was removed:
- ----- Method: WeekTest>>testEnumerating (in category 'Tests') -----
- testEnumerating
- 
- 	| days |
- 	days := OrderedCollection new.
- 	0 to: 6 do: [ :i | days add: ('28 June 1998' asDate addDays: i) ].
- 
- 	week datesDo: [ :d | days remove: d ].
- 	
- 	self assert: days isEmpty.
- !

Item was removed:
- ----- Method: WeekTest>>testIndexOfDay (in category 'Tests') -----
- testIndexOfDay
- 	| days |
- 	days := #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).
- 	
- 	days withIndexDo: [:item :index | self assert: (Week indexOfDay: item) = index].
- 	
- 	"This should probably raise an error rather than returning 0."
- 	self assert: (Week indexOfDay: 0) = 0.
- 	self assert: (Week indexOfDay: 1) = 0.
- 	self assert: (Week indexOfDay: 7) = 0.
- 	self assert: (Week indexOfDay: 8) = 0.
- 	self assert: (Week indexOfDay: #Sunnyday) = 0.!

Item was removed:
- ----- Method: WeekTest>>testInquiries (in category 'Tests') -----
- testInquiries
- 
- 	self
- 		assert: week start asDate = '28 June 1998' asDate;
- 		assert: week end asDate = '4 July 1998' asDate;
- 		assert: week index = 5;
- 		assert: week duration = (7 days).
- !

Item was removed:
- ----- Method: WeekTest>>testNameOfDay (in category 'Tests') -----
- testNameOfDay
- 	| days |
- 	days := #(#Sunday #Monday #Tuesday #Wednesday #Thursday #Friday #Saturday).
- 	
- 	days withIndexDo: [:item :index | self assert: (Week nameOfDay: index) = item].
- 	
- 	self shouldRaiseError: [Week nameOfDay: 0].
- 	self shouldRaiseError: [Week nameOfDay: 8].
- 	self shouldRaiseError: [Week nameOfDay: #Sunday].!

Item was removed:
- ----- Method: WeekTest>>testPreviousNext (in category 'Tests') -----
- testPreviousNext
- 	self
- 		assert: week next = (Week starting: '6 July 1998' asDate);
- 		assert: week previous = (Week starting:  '22 June 1998' asDate)!

Item was removed:
- TestCase subclass: #YearMonthWeekTest
- 	instanceVariableNames: 'restoredStartDay restoredTimeZone localTimeZonePreferenceToRestore'
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!
- 
- !YearMonthWeekTest commentStamp: 'tlk 1/6/2004 17:55' prior: 0!
- I am one of several Sunit test Cases intentended to provide complete coverage for the Chronology set of classes as part of the external testing. See DateAndEpochTestCase for a complete list.  tlk.
- I have no fixtures but do make sure to restore anything I change.!

Item was removed:
- ----- Method: YearMonthWeekTest>>setUp (in category 'running') -----
- setUp
- 	restoredStartDay := Week startDay.
- 	restoredTimeZone := DateAndTime localTimeZone.
- 	localTimeZonePreferenceToRestore := DateAndTime automaticTimezone.
- 	Week startDay: #Sunday.
- 	DateAndTime localTimeZone: (TimeZone timeZones detect: [:tz | tz abbreviation = 'GMT']).
- !

Item was removed:
- ----- Method: YearMonthWeekTest>>tearDown (in category 'running') -----
- tearDown
- 	Week startDay: restoredStartDay.
- 	DateAndTime localTimeZone: restoredTimeZone.
- 	DateAndTime automaticTimezone: localTimeZonePreferenceToRestore.!

Item was removed:
- ----- Method: YearMonthWeekTest>>testDaysInMonth (in category 'testing') -----
- testDaysInMonth
- 	self assert: (Month daysInMonth: 2 forYear: 2000) = 29.
- 	self assert: (Month daysInMonth: 2 forYear: 2001) = 28.
- 	self assert: (Month  daysInMonth: 2 forYear: 2004) = 29.
- 	self assert: (Month  daysInMonth: 2 forYear: 2100) = 28.
- 	
- 	self assert: (Month  daysInMonth: 'January' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'February' forYear: 2003) = 28.
- 	self assert: (Month  daysInMonth: 'March' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'April' forYear: 2003) = 30.
- 	self assert: (Month  daysInMonth: 'May' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'June' forYear: 2003) = 30.
- 	self assert: (Month  daysInMonth: 'July' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'August' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'September' forYear: 2003) = 30.
- 	self assert: (Month  daysInMonth: 'October' forYear: 2003) = 31.
- 	self assert: (Month  daysInMonth: 'November' forYear: 2003) = 30.
- 	self assert: (Month  daysInMonth: 'December' forYear: 2003) = 31.!

Item was removed:
- ----- Method: YearMonthWeekTest>>testDaysInYear (in category 'testing') -----
- testDaysInYear
- 	self assert: (Year daysInYear: 2000) = 366.
- 	self assert: (Year daysInYear: 2001) = 365.
- 	self assert: (Year daysInYear: 2004) = 366.
- 	self assert: (Year daysInYear: 2100) = 365.
- 	self assert: (Year daysInYear: 2003) = 365.!

Item was removed:
- ----- Method: YearMonthWeekTest>>testIndexOfDay (in category 'testing') -----
- testIndexOfDay
- 	self assert: (Week indexOfDay: 'Friday') = 6.
- 
- !

Item was removed:
- ----- Method: YearMonthWeekTest>>testIsLeapYear (in category 'testing') -----
- testIsLeapYear
- 	self assert: (Year isLeapYear: 2000).
- 	self deny: (Year isLeapYear: 2001).
- 	self assert: (Year isLeapYear: 2004).
- 	self deny: (Year isLeapYear: 2100).
- 	self deny: (Year isLeapYear: 2002).!

Item was removed:
- ----- Method: YearMonthWeekTest>>testMonthPrintOn (in category 'testing') -----
- testMonthPrintOn
- 	| aMonth ws |
- 	aMonth := Month starting: DateAndTime new duration: 31 days.
- 	ws := '' writeStream.
- 	aMonth printOn: ws.
- 	self assert: ws contents = 'January 1901'.!

Item was removed:
- ----- Method: YearMonthWeekTest>>testStartDay (in category 'testing') -----
- testStartDay
- 	Week startDay: 'Wednesday'.
- 	self assert: Week startDay = 'Wednesday'.
- 	Week startDay: 'Thursday'.
- 	self assert: Week startDay = 'Thursday'.
- 
- !

Item was removed:
- ----- Method: YearMonthWeekTest>>testWeekPrintOn (in category 'testing') -----
- testWeekPrintOn
- 	| aWeek cs rw |
- 	aWeek := Week starting: (DateAndTime year: 1900 month: 12 day: 31).
- 	cs := 'a Week starting: 1900-12-30T00:00:00+00:00'.
- 	rw := WriteStream on: ''.
- 	aWeek printOn: rw.
- 	self assert: rw contents = cs!

Item was removed:
- ----- Method: YearMonthWeekTest>>testYearPrintOn (in category 'testing') -----
- testYearPrintOn
- 	| aYear ws |
- 	aYear := Year starting: DateAndTime new duration: 365 days.
- 	ws := '' writeStream.
- 	aYear printOn: ws.
- 	self assert: ws contents = 'a Year (1901)'.!

Item was removed:
- ClassTestCase subclass: #YearTest
- 	instanceVariableNames: ''
- 	classVariableNames: ''
- 	poolDictionaries: ''
- 	category: 'Chronology-Tests'!

Item was removed:
- ----- Method: YearTest>>classToBeTested (in category 'Coverage') -----
- classToBeTested
- 
- 	^ Year!

Item was removed:
- ----- Method: YearTest>>testCurrent (in category 'Tests') -----
- testCurrent
- 	self assert:
- 		Year current start =
- 			((DateAndTime
- 				year: DateAndTime now year
- 				month: 1
- 				day: 1) offset: Year defaultOffset)!

Item was removed:
- ----- Method: YearTest>>testPreviousInLeapYear (in category 'Tests') -----
- testPreviousInLeapYear
- 
- 	| leap |
- 	leap := Year year: 2008.
- 	self assert: leap isLeapYear. 
- 	self assert: (Year year: (leap year - 1)) = leap previous !



More information about the Squeak-dev mailing list