Add tests for >=#865
Conversation
| [clojure.core-test.portability #?(:cljs :refer-macros :default :refer) [when-var-exists] :as p])) | ||
|
|
||
| (when-var-exists >= | ||
| (deftest test->= |
There was a problem hiding this comment.
nitpick, I think test>= is more clear since to me this looks like we're testing some function/macro ->=
There was a problem hiding this comment.
The template has a standard format: "test-" appended with function name. I'm going to leave this as is unless you have a lot of heartburn, just for consistency with every other test.
| true 0 0 | ||
| true 1 1 | ||
| true -1 -1 | ||
| true ##Inf ##Inf | ||
| true ##-Inf ##-Inf | ||
| false ##NaN ##NaN ; ##NaN is never equal, even to itself |
There was a problem hiding this comment.
indentation is weird here
| (is (= true (apply >= 10 (reverse (range 10))))) | ||
| (is (= false (apply >= -1 (reverse (range 10)))))) | ||
|
|
||
| (testing "negative tests" |
There was a problem hiding this comment.
I think we'll want to scale back on these negative tests, since they're technically undefined behavior in Clojure. The docs string for >= says Returns non-nil if nums are in monotonically non-decreasing order, otherwise false. so there is an implication that all inputs must be nums.
Interestingly, the doc string also says non-nil, rather than true.
There was a problem hiding this comment.
Yeah "returns non-nil" is very oddly non specific
There was a problem hiding this comment.
I'll switch the tests to check for non-nil and false as opposed to true and false.
There was a problem hiding this comment.
Also removed all negative tests for anything other than numbers and nil.
E-A-Griffin
left a comment
There was a problem hiding this comment.
Small things but looks good to me!
|
One thing that I think could be a good add would be binary numeric comparisons for applicable hosts, Clojure, ClojureScript, ClojureCLR, bb for example have |
|
Also would be good to test negative Infinity |
I like the out-of-the-box thinking, but in this case, |
Good thinking. |
There are multiple tests with |
I agree with this. There's no added benefit as the syntax is just specific to the reader and it's all converted to integers by the time it reaches |
|
Changing this to draft PR until I can change the tests to check for non-nil rather than |
|
Alright, I think this is ready to go now. |
|
Thanks, Dave! |
Closes #123