I have a function with a bug:
user> (-> 42 int-to-bytes bytes-to-int)
42
user> (-> 128 int-to-bytes bytes-to-int)
-128
user>
looks like I need to handle overflow when converting back...
Better write a test to make sure this never happens again. This project is using clojure.contrib.test-is so 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 converting to a seq of bytes and back again produces the origional result on a list of 10000 random numbers. Looks OK in theory? except none of the tests ever run.
Testing com.cryptovide.miscTest
Ran 23 tests containing 34 assertions.
0 failures, 0 errors.
- why don't the tests run?
- what can I do to make them run?