3 ms·
There are a lot of things I'd love to see change in the testing world. One would be a way to write a second implementation that is used to test or generate tes
by postalrat 4y ago
There are a lot of things I'd love to see change in the testing world.
One would be a way to write a second implementation that is used to test or generate tests. For example if I want to test a function that adds two numbers ("add") it would be really nice to be able to write: test(add, (a, b) => a + b)
IMO tests kinda boil down to write it twice and hope you got it right once.
- JonChesterfield 4y agoI routinely write a simple implementation with tests, then a fast implementation that passes the same tests, then check the two did the same thing on every call in a debug/contracts build. Mix it with design by contact as the sibling post suggests and you get 'postcondition: did same thing as the simple implementation', which combined with tests to check said thing was broadly sensible, seems to suffice.
- hinkley 4y agoYou might get a kick out of property based testing.