Skip to content

Commit

Permalink
Started adding some quickcheck tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ngerakines committed Feb 9, 2009
1 parent 998888d commit bf50127
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
12 changes: 12 additions & 0 deletions eqct/Makefile
@@ -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
20 changes: 20 additions & 0 deletions eqct/eqct_protobuffs_basic.erl
@@ -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)
).

0 comments on commit bf50127

Please sign in to comment.