htm-community / comportex

Hierarchical Temporal Memory in Clojure
154 stars 27 forks source link

Specification and testing with clojure.spec #47

Closed floybix closed 7 years ago

floybix commented 7 years ago

Fixes #24

I'm not finished but this is useful enough for now, and it will be an ongoing part of normal development to spec other stuff as needed. I've spec'd

This will be good for documentation too, once I can generate docs with the specs included.

I particularly like encoders-test where this line

(stest/check `p/encode)

generates random encoders with random parameter values, and feeds them random input values.

Similarly, one of the tests in spec-checks generates layers with random parameter values and feeds them random sets of bits.

Breaking changes, will need corresponding updates to Sanity.