|
|
|
|
|
by cryptonector
1511 days ago
|
|
Pure, deterministic code is easier to test than impure, non-deterministic code. There's no test environment setup for the former. No need to setup networking, DNS, PKI, etc. No need to have containers. For the "functional code" you just furnish inputs and compare to expected outputs. Sort of like test vectors for cryptographic functions. You still have to be careful to test all the edge cases (assuming you can't test the full domain of each function), naturally. But the fact that the functional core doesn't need setup means the tests of it have less startup and teardown overhead and so will generally run faster (unless they take so much time that setup overhead is in the noise). As for the "imperative shell", you may be able to mock everything w/o having to change it, though you could also set up a test environment with all the external things it needs. |
|