David T. Lewis uploaded a new version of Chronology-Tests to project The Inbox:
http://source.squeak.org/inbox/Chronology-Tests-dtl.25.mcz ==================== Summary ==================== Name: Chronology-Tests-dtl.25 Author: dtl Time: 28 March 2021, 10:52:19.196147 am UUID: c5ee558b-5ac5-4d89-812c-4cfd106b45e2 Ancestors: Chronology-Tests-dtl.24 Expect that "1 second" should be a synonym for "1 seconds" so that "5 second" does not answer one second. Likewise for minute, hour, etc. =============== Diff against Chronology-Tests-dtl.24 =============== Item was added: + ----- 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 added: + ----- 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 added: + ----- 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 added: + ----- 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 added: + ----- 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 added: + ----- 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 added: + ----- 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 added: + ----- 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. + ! |
In earlier discussion, I believe we had general consensus that having
"5 second" answer 1 second was not good, and also that simply treating #second and synonym for #second would be the preferred approach. These tests document the expectations, and Chronology-Core-dtl.66 implements the change. Both in the inbox now, and if no further comment I'll move to trunk in a few days. Dave On Sun, Mar 28, 2021 at 02:52:19PM +0000, [hidden email] wrote: > David T. Lewis uploaded a new version of Chronology-Tests to project The Inbox: > http://source.squeak.org/inbox/Chronology-Tests-dtl.25.mcz > > ==================== Summary ==================== > > Name: Chronology-Tests-dtl.25 > Author: dtl > Time: 28 March 2021, 10:52:19.196147 am > UUID: c5ee558b-5ac5-4d89-812c-4cfd106b45e2 > Ancestors: Chronology-Tests-dtl.24 > > Expect that "1 second" should be a synonym for "1 seconds" so that "5 second" does not answer one second. Likewise for minute, hour, etc. > > =============== Diff against Chronology-Tests-dtl.24 =============== > > Item was added: > + ----- 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 added: > + ----- 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 added: > + ----- 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 added: > + ----- 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 added: > + ----- 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 added: > + ----- 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 added: > + ----- 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 added: > + ----- 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. > + ! > > |
Free forum by Nabble | Edit this page |