[erlang-questions] proper char() type

Ryan Maclear ryanm@REDACTED
Thu May 17 11:54:08 CEST 2018


Hi All,

I've gone through the code for the integer() type and have found where my
issue arises from.

the proper_gen:pick/1 function has a default Size of 10, but the
proper_gen:pick/2 function provides for a size to be passed.

If I call:

proper_gen:pick(proper_types:char(), 1114111), I get results as expected.

Since the definition of char() is equivalent to integer(0,16#10ffff), I
would have expected the proper_gen:pick_type(proper_types:char()) call to
result in the arity 2 version of this function being called, or at least
have the Size set to the upper bound of the integer range in the
integer_gen function call, either in proper_types:integer_gen/2 function
call.

Does this make sense or am I missing something?

Regards,
Ryan Maclear




On 17 May 2018 at 11:08, Ryan Maclear <ryanm@REDACTED> wrote:

> Appologies, I hit send before finisinh the email. Here is the complete
> mail:
>
> I'm busy learning to use proper and have the following issue. When calling
> the function
>
> From the API docs, the char() type has a range of 0 to (1114111) 16#10ffff.
>
> When calling the function
>
> proper_gen:pick(proper_types:term()).
>
> manually many times (I've tried in around 3000 times) and on different
> VMs, the function always seems to return only one of the following values:
>
> {ok,0},
> {ok,2},
> {ok,3},
> {ok,6}
> {ok,12} and
> {ok,13}
>
> I see the same behaviour for
>
> proper_gen:pick(proper_types:range(0,16#10ffff)).
>
> which I believe is equivalent.
>
> I have tried on erlang 19.3.6.9, erlang 20.3.6 on a Mac as well as on a
> ubuntu trusty docker image with erlang 19.3.
>
> In all three vms I see the same set of results being returned.
>
> Is there something else I need to do before calling this function?
>
> Thanks,
> Ryan
>
>
> On 17 May 2018 at 11:07, Ryan Maclear <ryanm@REDACTED> wrote:
>
>> Good Day,
>>
>> I'm busy learning to use proper and have the following issue. When
>> calling the function
>>
>> From the API docs, the char() type has a range of 0 to (1114111)
>> 16#10ffff.
>>
>> When calling the function
>>
>> proper_gen:pick(proper_types:term()).
>>
>> manually many times (I've tried in around 3000 times) and on different
>> VMs, the function always seems to return only one of the following values:
>>
>> {ok,0},
>> {ok,2},
>> {ok,3},
>> {ok,6}
>> {ok,12} and
>> {ok,13}
>>
>> I see the same behaviour for
>>
>>
>> I have tried on erlang 19.3.6.9, erlang 20.3.6 on a Mac as well as on a
>> ubuntu trusty docker image with erlang 19.3.
>>
>> In all three vms I see the same set of results being returned.
>>
>> Is there something else I need to do before calling this function?
>>
>> Thanks,
>> Ryan
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180517/1f647cc2/attachment.htm>


More information about the erlang-questions mailing list