UTF8 generator #83

Closed
wants to merge 2 commits into
from

Projects

None yet

3 participants

@Motiejus
Contributor
Motiejus commented Mar 8, 2014

WIP; currently not possible to test proper shrinking because of
implementation using ?FORALL().

@Motiejus
Contributor
Motiejus commented Mar 8, 2014

We need an approach to test shrinking of user-defined types as well as specify some correct and incorrect cases in the tests.

Motiejus added some commits Mar 8, 2014
@Motiejus Motiejus UTF8 generator
WIP; currently not possible to test proper shrinking because of
implementation using ?FORALL().
66b43d2
@Motiejus Motiejus Isolate proper_unicode to its own module a3433c3
@manopapad
Owner

Would constructed_types_with_data() work for this? This list is set up specifically for user-defined types, but expects all correct and incorrect cases to be specified in intermediate format (i.e., with the let-bound values present, e.g. {'$used',5,25} for ?LET(X,range(1,5),X*X), rather than just 25).

So, the first test tuple:

{utf8(), [<<>>,<<0>>,<<127>>,<<197,161>>],<<>>, [...], "utf8()"}

would become:

{utf8(), [{'$used',{'$used',0,[]},<<>>},
          {'$used',{'$used',1,[0]},<<0>>},
          {'$used',{'$used',1,[127]},<<127>>},
          {'$used',{'$used',1,[50593]},<<197,161>>}], <<>>, [...], "utf8()"}

I.e., you'd need to specify exactly how each of the values could be constructed. This is for the benefit of the instance checking code (it would be much harder to verify, in the absence of let-bound values, if the final value is/isn't a valid instance of the type).

@kostis
Collaborator
kostis commented Mar 25, 2014

This pull request has been sitting quite long already... It would be good for @Motiejus to either react on the comment of @manopapad (possibly by revising the PR) or give me the "go ahead" so that I can merge this as is (and we can revise it later).

@Motiejus
Contributor

@kostis I have been very busy lately, sorry for a late reply.

@manopapad copy-pasting your example produces a failing test (clean state assertion fails). I lack knowledge of internals understand why the test fails and what it really means when it fails. I once took a tour to proper internals and didn't break it; I don't think I want to retry without hand-holding or a few spare days ahead of me in isolation.

For the short term, if users need the feature, we can just merge this pull request. If one of you can look at Manolis' test and explain to me why exactly it fails and what it is supposed to do (the handholding part), I would gladly monkey-type rest of the test cases.

@manopapad manopapad closed this in 3d211d6 Mar 30, 2014
@manopapad
Owner

I made the required modifications and merged the commits. The commit message on 7c20b4e has more information on the modifications. Thanks for your help Motiejus!

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