Bug 13014 – Test Phobos with a QuickCheck-like tool too?

Status
NEW
Severity
enhancement
Priority
P4
Component
tools
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-02T00:22:17Z
Last change time
2022-12-17T10:32:33Z
Assigned to
No Owner
Creator
Brad Roberts

Comments

Comment #0 by braddr — 2014-07-02T00:22:17Z
(Originally posted by [email protected]) QuickCheck is a testing tool widely used in Haskell: http://www.haskell.org/haskellwiki/Introduction_to_QuickCheck1 http://en.wikipedia.org/wiki/QuickCheck > In QuickCheck the programmer writes assertions about logical properties that a function should fulfill. Then QuickCheck attempts to generate test cases that falsify these assertions.< The test cases are generated randomly, up to a certain length and complexity, that can be specified. In Haskell there is also a similar tool, SmallCheck, that "allows to verify properties for all test cases up to some depth", so its test cases are not random, it's deterministic: http://ro-che.info/articles/2013-02-19-smallcheck.html https://github.com/feuerbach/smallcheck There are QuickCheck-like tools for most languages, including D and C++: https://github.com/mcandre/dashcheck http://software.legiasoft.com/quickcheck/ In this enhancement request I suggest to consider using a QuickCheck-like tool (like DashCheck) to test Phobos, and to better remove Phobos bugs. The functions that specify the logical proprieties of the Phobos code should be bundled inside the standard D distributions, like the unittests. One side effect of shipping the D compiler with a QuickCheck-like tool (used for Phobos, and later for the front-end written in D) is to encourage D programmers to use such standard tool in their programs. I think this could improve the quality of all D code, beyond Phobos. Note: such testing functions are similar to the post-conditions. So in theory a well implemented QuickCheck-like tool for D should use the post-conditions to generate the test cases.