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.