Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Phobos with a QuickCheck-like tool too? #94

Open
mdparker opened this issue Jun 21, 2023 · 0 comments
Open

Test Phobos with a QuickCheck-like tool too? #94

mdparker opened this issue Jun 21, 2023 · 0 comments

Comments

@mdparker
Copy link
Member

braddr reported this on 2014-07-02T00:22:17Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=13014

CC List

  • bugzilla

Description

(Originally posted by bearophile_hugs@eml.cc)

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.

Comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant