I have a function with an error:
user> (-> 42 int-to-bytes bytes-to-int) 42 user> (-> 128 int-to-bytes bytes-to-int) -128 user>
it looks like I need to handle overflow on the inverse transform ...
Better write a test to make sure it never happens again. This project uses clojure.contrib.test - this is how I write:
(deftest int-to-bytes-to-int (let [lots-of-big-numbers (big-test-numbers)] (map #(is (= (-> % int-to-bytes bytes-to-int) %)) lots-of-big-numbers)))
This should be testing the conversion to seq from bytes and vice versa, which gives the original result in a list of 10,000 random numbers. In order? except that none of the tests have ever been run.
Testing com.cryptovide.miscTest Ran 23 tests containing 34 assertions. 0 failures, 0 errors.
- Why are tests not running?
- what can i do to run them?
source share