digitalmars.D - Hypothesis equivalent for D?
- James Lu (8/8) Apr 10 2021 Hypothesis is a Python library for generating tests.
- Andrei Alexandrescu (6/18) Apr 10 2021 Nice idea, thanks for sharing. I don't think there's a D equivalent, and...
- James Lu (10/12) Apr 12 2021 In Python, hypothesis is used with icontract, a Design-by-Contract
- Robert burner Schadek (2/5) Apr 12 2021 Property-based testing in unit-threaded which was based on
- Atila Neves (4/10) Apr 16 2021 Yep, here:
Hypothesis is a Python library for generating tests. https://hypothesis.readthedocs.io/en/latest/quickstart.html from hypothesis import example, given, strategies as st given(st.text()) example("") def test_decode_inverts_encode(s): assert decode(encode(s)) == s What are the equivalent D libraries?
Apr 10 2021
On 4/10/21 11:47 AM, James Lu wrote:Hypothesis is a Python library for generating tests. https://hypothesis.readthedocs.io/en/latest/quickstart.html from hypothesis import example, given, strategies as st given(st.text()) example("") def test_decode_inverts_encode(s): assert decode(encode(s)) == s What are the equivalent D libraries?Nice idea, thanks for sharing. I don't think there's a D equivalent, and there's a need because there definitely are some instances of ad-hoc solutions in Phobos unittesting. Defining a systematic library for that stuff would be pretty awesome and would cut down a lot of duplication from Phobos.
Apr 10 2021
On Saturday, 10 April 2021 at 16:57:04 UTC, Andrei Alexandrescu wrote:Defining a systematic library for that stuff would be pretty awesome and would cut down a lot of duplication from Phobos.In Python, hypothesis is used with icontract, a Design-by-Contract library. Generated testcases are discarded if they don't meet the contract. icontract-hypothesis also has a mode that automatically infers hypothesis testcase generation strategy such that it always satisfies the contract. (!) https://pypi.org/project/icontract-hypothesis/
Apr 12 2021
Property-based testing in unit-threaded which was based on https://code.dlang.org/packages/std_benchmarkWhat are the equivalent D libraries?Nice idea, thanks for sharing. I don't think there's a D equivalent,
Apr 12 2021
On Tuesday, 13 April 2021 at 06:38:59 UTC, Robert burner Schadek wrote:Yep, here: https://github.com/atilaneves/unit-threaded/blob/cfdca0af7e40458bec66cfa7e959d4726496be7f/subpackages/property/source/unit_threaded/property.d#L173Property-based testing in unit-threaded which was based on https://code.dlang.org/packages/std_benchmarkWhat are the equivalent D libraries?Nice idea, thanks for sharing. I don't think there's a D equivalent,
Apr 16 2021