Created
October 23, 2012 17:55
-
-
Save puzza007/3940343 to your computer and use it in GitHub Desktop.
Proper record generator
This file contains hidden or 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
-module(foo). | |
-include_lib("proper/include/proper.hrl"). | |
-type audio_reference_type() :: user | department | client | system. | |
-compile(export_all). | |
-record(tf_audio_reference, { | |
type :: audio_reference_type(), | |
reference :: binary() | |
}). | |
-type tf_audio_reference() :: #tf_audio_reference{type :: audio_reference_type(), reference :: binary()}. | |
-type tf_audio_reference2() :: #tf_audio_reference{}. | |
prop_validate_audio_reference2() -> | |
?FORALL(A, {tf_audio_reference, audio_reference_type(), binary()}, | |
begin | |
A =:= tf_validate:validate(A) | |
end). | |
prop_validate_audio_reference3() -> | |
?FORALL(A, #tf_audio_reference{}, | |
begin | |
A =:= tf_validate:validate(A) | |
end). | |
prop_validate_audio_reference4() -> | |
?FORALL(A, tf_audio_reference(), | |
begin | |
A =:= tf_validate:validate(A) | |
end). | |
prop_validate_audio_reference5() -> | |
?FORALL(A, tf_audio_reference2(), | |
begin | |
A =:= tf_validate:validate(A) | |
end). |
This file contains hidden or 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
Erlang R15B03 (erts-5.9.3) [source] [64-bit] [smp:8:8] [async-threads:0] [hipe] [kernel-poll:false] | |
Eshell V5.9.3 (abort with ^G) | |
1> application:start(piqi). | |
ok | |
2> proper:quickcheck(foo:prop_validate_audio_reference2()). | |
.................................................................................................... | |
OK: Passed 100 test(s). | |
true | |
3> proper:quickcheck(foo:prop_validate_audio_reference3()). | |
! | |
Failed: After 1 test(s). | |
{tf_audio_reference,undefined,undefined} | |
Shrinking (0 time(s)) | |
{tf_audio_reference,undefined,undefined} | |
false | |
4> proper:quickcheck(foo:prop_validate_audio_reference4()). | |
.................................................................................................... | |
OK: Passed 100 test(s). | |
true | |
5> proper:quickcheck(foo:prop_validate_audio_reference5()). | |
! | |
Failed: After 1 test(s). | |
{tf_audio_reference,undefined,<<>>} | |
Shrinking .(1 time(s)) | |
{tf_audio_reference,undefined,undefined} | |
false | |
6> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment