-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proper and port gzip property test from Hex
- Loading branch information
1 parent
266bbf2
commit 3454ca1
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,6 @@ language: erlang | |
sudo: false | ||
otp_release: | ||
- 20.2 | ||
script: | ||
- rebar3 eunit | ||
- rebar3 proper |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
{erl_opts, [debug_info]}. | ||
{deps, []}. | ||
{plugins, [rebar3_proper]}. | ||
{deps, []}. | ||
{profiles, | ||
[{test, [ | ||
{deps, [{proper, "1.2.0"}, recon]} | ||
]} | ||
]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
-module(prop_hex_tarball). | ||
-include_lib("proper/include/proper.hrl"). | ||
|
||
prop_symmetric() -> | ||
?FORALL(Binary, binary(), | ||
begin | ||
zlib:gunzip(hex_tarball:gzip(Binary)) =:= Binary | ||
end). | ||
|
||
prop_equivalent() -> | ||
?FORALL(Binary, binary(), | ||
begin | ||
<<31, 139, 8, 0, 0, 0, 0, 0, 0, _Os, ZlibRest/binary>> = zlib:gzip(Binary), | ||
<<31, 139, 8, 0, 0, 0, 0, 0, 0, 0, HexRest/binary>> = hex_tarball:gzip(Binary), | ||
ZlibRest =:= HexRest | ||
end). |