forked from ngerakines/erlang_protobuffs
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started adding some quickcheck tests.
- Loading branch information
1 parent
998888d
commit bf50127
Showing
2 changed files
with
32 additions
and
0 deletions.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include ../support/include.mk | ||
|
||
all: $(EBIN_FILES) | ||
|
||
clean: | ||
rm -rf $(EBIN_FILES) erl_crash.dump simple_pb.* | ||
|
||
test: $(MODULES) | ||
|
||
./$(MODULES): | ||
@echo "Running tests for $@" | ||
erl -pa ../ebin -run $@ start -run init stop -noshell |
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,20 @@ | ||
-module(eqct_protobuffs_basic). | ||
-compile(export_all). | ||
-include_lib("eqc/include/eqc.hrl"). | ||
|
||
int32() -> | ||
?FORALL( | ||
Xs, | ||
nat(), | ||
{{1, Xs}, <<>>} == protobuffs:decode(list_to_binary(protobuffs:encode(1, Xs, int32)), int32) | ||
). | ||
|
||
string() -> | ||
?FORALL( | ||
Xs, | ||
list(char()), | ||
(fun(Var) -> | ||
{{1, Foo}, <<>>} = protobuffs:decode(list_to_binary(protobuffs:encode(1, Var, string)), string), | ||
Foo == list_to_binary(Var) | ||
end)(Xs) | ||
). |