QuickCheck is a form of automated specification testing. Instead of manually writing tests cases like so:
We can just write the assertion algebraically and tell QuickCheck to automatically generate lots of inputs:
Fantasy Check allows the easy testing of various laws whilst being unit testing framework agnostic.
The functor check has 2 different laws which allow you to test the mapping of tagged types. Note - it should be possible to test functions as well, by providing a map (aka compose) for the function type.
exportslaw1 = functorIdentityof;exportslaw2 = functorIdentityof;
The applicative functor check has 4 different laws which allow you to test:
exportslaw1 = functorIdentity;exportslaw2 = functorIdentity;exportslaw3 = functorIdentity;exportslaw4 = functorIdentity;
The monad check has 3 different laws which allow you to test:
- Left Identity
- Right Identity
exportslaw1 = functorIdentity;exportslaw2 = functorIdentity;exportslaw3 = functorIdentity;
Currently Fantasy Check is using Istanbul for code coverage analysis; you can run the coverage via the following command:
This assumes that you have istanbul installed correctly.
istanbul cover nodeunit -- test/*.js
It should report that the total coverage is at 100% for the whole lib.