On Tue, Jun 5, 2012 at 5:04 PM, Damien Cassou <damien.cassou@gmail.com> wrote:
On Tue, Jun 5, 2012 at 11:55 AM, Camillo Bruni <camillobruni@gmail.com> wrote:
testGeneralInquiries    | now d t dt |
   now  := self timeClass dateAndTimeNow.    self        assert: now size = 2;        assert: now last <= self timeClass now.
   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.}.
The middle part is a GREAT example of a useful unit testâ¦
that's called a negative test :D, assume what possible could fail in the universe and test for it :D
I will write a paper on automatic negative test generation. Who wants to join? :-)
You can even write a program that write a paper about negative tests generation ;-) -- Serge Stinckwich UMI UMMISCO 209 (IRD/UPMC), Hanoi, Vietnam Every DSL ends up being Smalltalk http://doesnotunderstand.org/