On 08/10/14 23:37, Robert burner Schadek wrote:
Lately, I find myself wondering, if I should add parameterized unit
tests to std.string, because the last few bugs I fixed where not caught
by tests, as the test-data was not good enough. I know random data is
not perfect either, but it would be good addition IMO.

Additionally, I thought these unit tests could be used to benchmark the
performance of the functions and the compilers. Thus allowing continues
monitoring of performance changes.

I'm thinking of something like:

version(unittest_benchmark) {
unittest {
     auto ben = Benchmark("bench_result_file", numberOfRuns);
     auto values = ValueGen!(StringGen(0, 12), IntGen(2, 24))(ben);

     foreach(string rStr, int rInt; values) {
         auto rslt = functionToTest(rStr, rInt);
         // some asserts
     }
}
}

The bench_result_file would be a csv with e.g. date,runtime,...

ideas, suggestions?

I think you should use a UDA's instead. The a unit test framework can, hopefully, handle this automatically.

--
/Jacob Carlborg

Reply via email to