October 09, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | I get the bracing point, but how does this translate to my unit testing (quickcheck) problem? | |||
October 10, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | 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 | |||
October 10, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Friday, 10 October 2014 at 06:39:25 UTC, Jacob Carlborg wrote:
>
> I think you should use a UDA's instead. The a unit test framework can, hopefully, handle this automatically.
This will work for me private project, but I want this in std.string.
| |||
October 10, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On 10/10/14 10:09, Robert burner Schadek wrote: > This will work for me private project, but I want this in std.string. Why wouldn't this working std.string? -- /Jacob Carlborg | |||
October 12, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Friday, 10 October 2014 at 14:20:39 UTC, Jacob Carlborg wrote:
> On 10/10/14 10:09, Robert burner Schadek wrote:
>
>> This will work for me private project, but I want this in std.string.
>
> Why wouldn't this working std.string?
because, this would require changing the phobos unittester, doing it non intrusive inside the unittest is way more likely to succeed. add is more flexible IMO.
| |||
October 14, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On 10/08/2014 11:37 PM, 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. > https://github.com/MartinNowak/qcheck Haven't used it for quite a while, file a bug report if anything doesn't work. | |||
October 14, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Tuesday, 14 October 2014 at 06:54:42 UTC, Martin Nowak wrote:
> On 10/08/2014 11:37 PM, 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.
>>
>
> https://github.com/MartinNowak/qcheck
> Haven't used it for quite a while, file a bug report if anything doesn't work.
well quite a nice and big library. You add the benchmark feature, get a merged into phobos and I will gladly use it to test std.string.
| |||
October 14, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Robert burner Schadek | On 10/14/2014 10:38 AM, Robert burner Schadek wrote:
> well quite a nice and big library. You add the benchmark feature, get a
> merged into phobos and I will gladly use it to test std.string.
Not sure whether a random testing library belongs into phobos.
| |||
October 14, 2014 Re: Parameterized unit testing and benchmarking of phobos | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | On Tuesday, 14 October 2014 at 12:17:05 UTC, Martin Nowak wrote:
> On 10/14/2014 10:38 AM, Robert burner Schadek wrote:
>> well quite a nice and big library. You add the benchmark feature, get a
>> merged into phobos and I will gladly use it to test std.string.
>
> Not sure whether a random testing library belongs into phobos.
After taking a look at the bug I found in std.string, I think that this is a good first step.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply