Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lordnull/erlang_protobuffs
Browse files Browse the repository at this point in the history
…into lordnull-master
  • Loading branch information
freke committed Dec 9, 2010
2 parents c80b0b0 + f7f84d1 commit 623b8f1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/erlang_protobuffs_SUITE.erl
Expand Up @@ -260,6 +260,13 @@ parse_extensions_test_case(Config) ->
protobuffs_compile:scan_file(Path),
true = eqc:quickcheck(eqc:numtests(NumTests,protobuffs_eqc:prop_protobuffs_extentions())).

%parse_service_test_case(Config) ->
% DataDir = ?config(data_dir, Config),
% NumTests = ?config(num_tests, Config),
% Path = filename:absname(filename:join([DataDir, "service.proto"])),
% protobuffs_compile:scan_file(Path),
% true = eqc:quickcheck(eqc:numtests(NumTests,protobuffs_eqc:prop_protobuffs_extentions())).

parse_addressbook_test_case(Config) ->
DataDir = ?config(data_dir, Config),
NumTests = ?config(num_tests, Config),
Expand Down
20 changes: 20 additions & 0 deletions test/protobuffs_eqc.erl
Expand Up @@ -277,6 +277,26 @@ prop_protobuffs_enum() ->
compare_messages(Middle,Decoded)
end).

enum_outside_value() ->
oneof(['FIRST','SECOND']).

prop_protobuffs_enum_outside() ->
?FORALL({Middle},
{default({enumuser,undefined},{enumuser,enum_outside_value()})},
begin
Decoded = enum_outside_pb:decode_enumuser(enum_outside_pb:encode_enumuser(Middle)),
compare_messages(Middle,Decoded)
end).

prop_protobuffs_extentions() ->
?FORALL({Middle},
{default({extendable},{maxtendable})},
begin
DecodeFunc = list_to_atom("decode_" ++ atom_to_list(element(1, Middle))),
Decoded = extensions_pb:DecodeFunc(extensions_pb:encode(Middle)),
compare_messages(Middle,Decoded)
end).

address_phone_number() ->
list({person_phonenumber,string(),default(undefined,oneof(['HOME','WORK','MOBILE']))}).

Expand Down

0 comments on commit 623b8f1

Please sign in to comment.