Is anyone looking at enabling proper data-driven tests by example. Trivial example: Factorial implementations, you just want to write a few examples in a table and have the compiler test them all individually with all being tested even if some fail. In languages that have assertions with termination semantics this is impossible to do with loops. Languages like Go have a test framework with no assertions per se just tools for reporting an error: in Go table driven testing is trivially easy. In Python, at least using PyTest, there is the @pytest.mark.parametrize decorator that writes separate functions for each data item given the test function template. This works very nicely with the Python approach of terminating assertions since on execution there is a test function per test case from the table.
I am finding that although this can be done trivially in dynamic languages, in static languages it is less so. Scala can do it due to the language semantics and macros. Rust cannot do it yet, the macro system isn't up to it. What about D? Has anyone tinkered with this? As an ancillary question: has anyone got a property-testing framework in D. The original is from Haskell, QuickCheck. Ceylon and similar languages have a pale imitation, Rust has the real thing. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
