slyrus / opticl

An image processing library for Common Lisp
Other
182 stars 35 forks source link

Some tests assume new arrays are full of 0, and are not using 5am:IS correcly #39

Closed Yehouda closed 2 years ago

Yehouda commented 2 years ago

The tests for mapping array in test/opticl-test.lisp, map-array-8-bit-rgba and map-array-double-float-rgb, effectively assume that the array they make is full of 0, but there is nothing that guarantees it.

They don't actually fail, because they also use 5am:IS incorrectly. They do (is (map-array ..) value), when the intention is (is (equalp (map-array..) value)) (like earlier usages of 5am:IS in this file). But at least on LispWorks, it sometimes gets an error in map-array-8-bit-rgba, because if the value in any element happens to be 255, it tries to change it to 256, which is too big for 8-bit.

Either the tests need to pass initial-element, or maybe the make functions ( opticl:make-8-bit-rgba-image and friends) change to default the elements to 0.

slyrus commented 2 years ago

Thanks. Should be fixed now.