Skip to content

Commit

Permalink
Add proper_stdgen:bytestring/0 generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Rashkovskii committed Jul 27, 2011
1 parent 491ed9f commit 202ef73
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/proper_stdgen.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ latin_char() ->
number_char() ->
integer(48,57).

bytestring() ->
list(byte()).

binary_string(IO) ->
?LET(Io, IO,
iolist_to_binary(Io)).
Expand Down
6 changes: 5 additions & 1 deletion test/proper_stdgen_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ prop_number_char() ->
?FORALL(Char, proper_stdgen:number_char(),
integer_to_list(list_to_integer([Char])) =:= [Char]).

prop_binary_bytestring() ->
?FORALL(String, proper_stdgen:bytestring(),
binary_to_list(list_to_binary(String)) =:= String).

prop_binary_string_string() ->
?FORALL(String, proper_stdgen:binary_string(list(byte())),
?FORALL(String, proper_stdgen:binary_string(proper_stdgen:bytestring()),
is_binary(String)).

prop_binary_string_binary() ->
Expand Down

0 comments on commit 202ef73

Please sign in to comment.