[squeak-dev] DateAndTimeLeapTest>>testAsSeconds is broken

David T. Lewis lewis at mail.msen.com
Sun Dec 4 00:03:36 UTC 2016


On Wed, Nov 30, 2016 at 10:51:05PM -0500, David T. Lewis wrote:
> DateAndTimeLeapTest>>testAsSeconds is broken. The test passes incorrectly as a
> result of a false assertion:
> 
> 	self assert: aDateAndTime asSeconds = 3255514380.
> 
> Where aDateAndTime is specified in #setUp
> 
> 	aDateAndTime := (DateAndTime year: 2004 month: 2 day: 29 hour: 13 minute: 33 second: 0 offset: 2 hours). 
> 
> This time is 2004-02-29T13:33:00+02:00, which in UTC is 2004-02-29T11:33:00+00:00.
> 
> The #asSeconds tests should test for elapsed seconds from the Smalltalk epoch
> until 2004-02-29T11:33:00+00:00. The correct number of seconds for this duration
> is 3255507180, not 3255514380 as asserted in the unit test.
> 
> By definition, #asSeconds is the seconds elapsed since the Smalltalk epoch
> (see its method comment). By common agreement, the Smalltalk epoch was defined
> relative to Greenwich Mean Time (UTC). If these two statements are both true,
> then the test is broken.
> 
> If there is no disagreement, I will fix the test and allow it to show the failure.

This thread has generated some interesting discussion, but my original
question remains.

The correct number of elapsed seconds from the Smalltalk epoch to
2004-02-29T13:33:00+02:00 is 3255507180. I want to change #testAsSeconds
assert this value. The test will fail, as it should.

Any objections?

Dave


More information about the Squeak-dev mailing list