digitalmars.D.learn - Randomized unittests
- Gorge Jingale (7/7) Jul 24 2016 Is there any leverage in the D library for doing randomized unit
- Chris Wright (8/17) Jul 24 2016 http://code.dlang.org/packages/unit-threaded
- Gorge Jingale (3/12) Jul 24 2016 Thanks, looks nice, a bit confusing but seems pretty useful.
Is there any leverage in the D library for doing randomized unit testing? Testing things with a range of possibilities instead of fixed. Each time the test is ran a different version is executed. This provides more coverage. How does one create a random number at compile time? Is this the only way: http://dpaste.dzfl.pl/668646ce6d71?
Jul 24 2016
On Mon, 25 Jul 2016 01:49:25 +0000, Gorge Jingale wrote:Is there any leverage in the D library for doing randomized unit testing? Testing things with a range of possibilities instead of fixed. Each time the test is ran a different version is executed. This provides more coverage. How does one create a random number at compile time? Is this the only way: http://dpaste.dzfl.pl/668646ce6d71?http://code.dlang.org/packages/unit-threaded Values() annotation on a unittest takes a range. Base that on a range that yields random values and Bob's your uncle. That range may need to be a compile-time constant. If so, it will be a little awkward to create, and you can ping Atila about possibly creating a ValuesFrom annotation that will take a method or lambda that yields a range of values.
Jul 24 2016
On Monday, 25 July 2016 at 02:36:04 UTC, Chris Wright wrote:On Mon, 25 Jul 2016 01:49:25 +0000, Gorge Jingale wrote:Thanks, looks nice, a bit confusing but seems pretty useful. But why is Bob my uncle? ;)[...]http://code.dlang.org/packages/unit-threaded Values() annotation on a unittest takes a range. Base that on a range that yields random values and Bob's your uncle. That range may need to be a compile-time constant. If so, it will be a little awkward to create, and you can ping Atila about possibly creating a ValuesFrom annotation that will take a method or lambda that yields a range of values.
Jul 24 2016