Thinking about test-is little more...

Lets look at this test for minus:

(deftest test-minus
   (all-true
     (number? (- 1 2))
     (integer? (- 1 2))
     (float? (- 1.0 2))
     (ratio? (- 2/3 1))
     (float? (- 2/3 (/ 1.0 3))))
   (throws IllegalArgumentException (-))
   (each=
     (- 1) -1
     (- 1 2) -1
     (- 1 2 3) -4

     (- -2) 2
     (- 1 -2) 3
     (- 1 -2 -3) 6

     (- 1 1) 0
     (- -1 -1) 0

     (- 2/3) -2/3
     (- 2/3 1) -1/3
     (- 2/3 1/3) 1/3

     (- 1.2) -1.2
     (- 2.2 1.1) 1.1
     (- 6.6 2.2 1.1) 3.3)
   ; no underflow :)
   (is (< (- Integer/MIN_VALUE 10) Integer/MIN_VALUE)))

There are currently 4 elements - all-true, throws, each=, is. I am  
scratching my head, trying to figure out, how to merge these together or  
to make it read better...

Ideas:

A) Lets merge 'is' and 'all-true'
Would it be possible to abandon the optional message 'is' macro has? I am  
sure, I will not use it. Then 'is' could accept multiple params and we are  
down to 3! (all-true is out)

B) What about 'throws' macro? Could this become a function returning  
true/false? Then we could stick it inside 'is' or 'all-true'. (I guess it  
doesn't matter that much, does it?)

C) Lets name them more similar, so it reads better: 'is', 'is-each',  
'is-true'.

Just what came to my mind :-)

Greetings, Frantisek

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to