digitalmars.D - Parameterized unit testing and benchmarking of phobos
- Robert burner Schadek (21/21) Oct 08 2014 Lately, I find myself wondering, if I should add parameterized
- Andrei Alexandrescu (2/4) Oct 08 2014 No need for the outer braces :o). -- Andrei
- Robert burner Schadek (5/9) Oct 08 2014 I just love my braces.
- Andrei Alexandrescu (3/10) Oct 08 2014 If you love your braces you gotta love your indentation. They come
- Robert burner Schadek (6/8) Oct 09 2014 I guess you're right, but back to the topic.
- Andrei Alexandrescu (4/10) Oct 09 2014 Not yet but I think we need to create a task and a plan for adding the
- Johannes Pfau (7/21) Oct 09 2014 +1, std.benchmark should be revived. There's still the constructor
- Andrei Alexandrescu (3/24) Oct 09 2014 My suggestion is to first use it in std.internal for a couple of months,...
- Robert burner Schadek (5/6) Oct 09 2014 -1, This really does not solve my problem. I need a parameterized
- Andrei Alexandrescu (15/21) Oct 09 2014 version (xyz) unittest
- Robert burner Schadek (2/2) Oct 09 2014 I get the bracing point, but how does this translate to my unit
- Jacob Carlborg (5/25) Oct 09 2014 I think you should use a UDA's instead. The a unit test framework can,
- Robert burner Schadek (3/5) Oct 10 2014 This will work for me private project, but I want this in
- Jacob Carlborg (4/5) Oct 10 2014 Why wouldn't this working std.string?
- Robert burner Schadek (4/8) Oct 12 2014 because, this would require changing the phobos unittester, doing
- Martin Nowak (4/8) Oct 13 2014 https://github.com/MartinNowak/qcheck
- Robert burner Schadek (4/16) Oct 14 2014 well quite a nice and big library. You add the benchmark feature,
- Martin Nowak (2/4) Oct 14 2014 Not sure whether a random testing library belongs into phobos.
- Robert burner Schadek (3/8) Oct 14 2014 After taking a look at the bug I found in std.string, I think
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?
Oct 08 2014
On 10/8/14, 2:37 PM, Robert burner Schadek wrote:version(unittest_benchmark) { unittest {No need for the outer braces :o). -- Andrei
Oct 08 2014
On Wednesday, 8 October 2014 at 23:31:59 UTC, Andrei Alexandrescu wrote:On 10/8/14, 2:37 PM, Robert burner Schadek wrote:I just love my braces. If that's gone be the most negative comment, I will have a PR ready before next week.version(unittest_benchmark) { unittest {No need for the outer braces :o). -- Andrei
Oct 08 2014
On 10/8/14, 4:44 PM, Robert burner Schadek wrote:On Wednesday, 8 October 2014 at 23:31:59 UTC, Andrei Alexandrescu wrote:If you love your braces you gotta love your indentation. They come together... -- AndreiOn 10/8/14, 2:37 PM, Robert burner Schadek wrote:I just love my braces.version(unittest_benchmark) { unittest {No need for the outer braces :o). -- Andrei
Oct 08 2014
On Thursday, 9 October 2014 at 00:13:25 UTC, Andrei Alexandrescu wrote:If you love your braces you gotta love your indentation. They come together... -- AndreiI guess you're right, but back to the topic. Has anyone tried something similar for phobos? (I couldn't find anything) Does anyone else consider the idea worth pursuing?
Oct 09 2014
On 10/9/14, 1:01 AM, Robert burner Schadek wrote:On Thursday, 9 October 2014 at 00:13:25 UTC, Andrei Alexandrescu wrote:Not yet but I think we need to create a task and a plan for adding the old std.benchmark to std.experimental.benchmark, and use it internally for Phobos. -- AndreiIf you love your braces you gotta love your indentation. They come together... -- AndreiI guess you're right, but back to the topic. Has anyone tried something similar for phobos? (I couldn't find anything) Does anyone else consider the idea worth pursuing?
Oct 09 2014
Am Thu, 09 Oct 2014 08:11:33 -0700 schrieb Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>:On 10/9/14, 1:01 AM, Robert burner Schadek wrote:+1, std.benchmark should be revived. There's still the constructor cycles issue but we can probably find workarounds. In the worst case we do not generate constructors but runBenchmark functions and call these manually via some runAllBenchmarks("std.xyz", "std.abc") template magic)On Thursday, 9 October 2014 at 00:13:25 UTC, Andrei Alexandrescu wrote:Not yet but I think we need to create a task and a plan for adding the old std.benchmark to std.experimental.benchmark, and use it internally for Phobos. -- AndreiIf you love your braces you gotta love your indentation. They come together... -- AndreiI guess you're right, but back to the topic. Has anyone tried something similar for phobos? (I couldn't find anything) Does anyone else consider the idea worth pursuing?
Oct 09 2014
On 10/9/14, 9:36 AM, Johannes Pfau wrote:Am Thu, 09 Oct 2014 08:11:33 -0700 schrieb Andrei Alexandrescu <SeeWebsiteForEmail erdani.org>:My suggestion is to first use it in std.internal for a couple of months, and only then propose it for inclusion. -- AndreiOn 10/9/14, 1:01 AM, Robert burner Schadek wrote:+1, std.benchmark should be revived. There's still the constructor cycles issue but we can probably find workarounds. In the worst case we do not generate constructors but runBenchmark functions and call these manually via some runAllBenchmarks("std.xyz", "std.abc") template magic)On Thursday, 9 October 2014 at 00:13:25 UTC, Andrei Alexandrescu wrote:Not yet but I think we need to create a task and a plan for adding the old std.benchmark to std.experimental.benchmark, and use it internally for Phobos. -- AndreiIf you love your braces you gotta love your indentation. They come together... -- AndreiI guess you're right, but back to the topic. Has anyone tried something similar for phobos? (I couldn't find anything) Does anyone else consider the idea worth pursuing?
Oct 09 2014
On Thursday, 9 October 2014 at 16:36:35 UTC, Johannes Pfau wrote:>+1, std.benchmark should be revived.-1, This really does not solve my problem. I need a parameterized unit test facility aka. Haskell QuickCheck with the additional benchmarking feature that allows me/us to track performance over time aka. benchmark result dump to file in csv style manner.
Oct 09 2014
On 10/9/14, 9:57 AM, Robert burner Schadek wrote:On Thursday, 9 October 2014 at 16:36:35 UTC, Johannes Pfau wrote:>version (xyz) unittest { ... } is a good idiom. I noticed you feel strongly about bracing but I unrecommend it (and we should disallow it for phobos) as it forces you to either double-indent everything (net loss) or create an exception with regard to indentation. Also the opening extra brace has a "garden path sentence" liability, it suggests more stuff will be encompassed by the brace but then only at the closing brace there's the realization there's only encompassed entity. The idiom is already used, see e.g. https://github.com/D-Programming-Language/phobos/blob/master/std/file.d#L322. Andrei+1, std.benchmark should be revived.-1, This really does not solve my problem. I need a parameterized unit test facility aka. Haskell QuickCheck with the additional benchmarking feature that allows me/us to track performance over time aka. benchmark result dump to file in csv style manner.
Oct 09 2014
I get the bracing point, but how does this translate to my unit testing (quickcheck) problem?
Oct 09 2014
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
Oct 09 2014
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.
Oct 10 2014
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
Oct 10 2014
On Friday, 10 October 2014 at 14:20:39 UTC, Jacob Carlborg wrote:On 10/10/14 10:09, Robert burner Schadek wrote: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.This will work for me private project, but I want this in std.string.Why wouldn't this working std.string?
Oct 12 2014
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.
Oct 13 2014
On Tuesday, 14 October 2014 at 06:54:42 UTC, Martin Nowak wrote:On 10/08/2014 11:37 PM, 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.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.
Oct 14 2014
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.
Oct 14 2014
On Tuesday, 14 October 2014 at 12:17:05 UTC, Martin Nowak wrote:On 10/14/2014 10:38 AM, Robert burner Schadek wrote:After taking a look at the bug I found in std.string, I think that this is a good first step.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.
Oct 14 2014