Hypothesis equivalent for D?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Apr 10 16:57:04 UTC 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.


More information about the Digitalmars-d mailing list