Skip to content

Commit

Permalink
Add property tests for string
Browse files Browse the repository at this point in the history
  • Loading branch information
kuenishi committed Sep 17, 2023
1 parent 4523023 commit 086f533
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/prop_msgpack.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ prop_msgpack() ->
{msgpack_object(), stable_opts()},
pack_and_unpack(Obj, Opts)).

prop_string() ->
?FORALL({Str, Opts},
{utf8(),
oneof(
[
[],
[{unpack_str, as_list},{pack_str, from_list},{validate_string,true}],
[{unpack_str, as_binary},{pack_str, from_binary},{validate_string,true}],
[{unpack_str, as_tagged_list},{pack_str, from_tagged_list},{validate_string,true}]
])},
pack_and_unpack(unicode:characters_to_list(Str), Opts)).


%%% Helpers %%%
pack_and_unpack(Obj, Opts) ->
Expand Down

0 comments on commit 086f533

Please sign in to comment.