Skip to content

Commit

Permalink
Start PropEr
Browse files Browse the repository at this point in the history
  • Loading branch information
kuenishi committed Sep 9, 2023
1 parent 6f98251 commit 24c5a48
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@
{erl_first_files, [
"src/msgpack_ext.erl"
]}.

{project_plugins, [rebar3_proper]}.

{profiles,
[{test, [
{erl_opts, [nowarn_export_all]},
{deps, [proper]}
]
}]
}.
31 changes: 31 additions & 0 deletions test/prop_msgpack.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-module(prop_msgpack).
-include_lib("proper/include/proper.hrl").
-include("msgpack.hrl").

%%%%%%%%%%%%%%%%%%
%%% Properties %%%
%%%%%%%%%%%%%%%%%%
prop_test() ->
?FORALL(Type, mytype(),
begin
boolean(Type)
end).

prop_pack() ->
?FORALL(Term, msgpack_object(),
begin
Bin = msgpack:pack(Term),
is_binary(Bin)
end).

%%%%%%%%%%%%%%%
%%% Helpers %%%
%%%%%%%%%%%%%%%
boolean(_) -> true.

%%%%%%%%%%%%%%%%%%
%%% Generators %%%
%%%%%%%%%%%%%%%%%%
msgpack_object() -> term().
mytype() ->
term().

0 comments on commit 24c5a48

Please sign in to comment.