浏览代码

Merge 5e8282f76e into 8a7c67265a

pull/80/merge
Alexander Shorin 9 年前
父节点
当前提交
c6dfb9b989
共有 3 个文件被更改,包括 11 次插入52 次删除
  1. +4
    -0
      rebar.config
  2. +0
    -37
      rebar.config.script
  3. +7
    -15
      test/jiffy_11_proper_tests.erl

+ 4
- 0
rebar.config 查看文件

@ -1,3 +1,7 @@
{deps, [
{triq, ".*", {git, "git://github.com/krestenkrab/triq.git", "master"}}
]}.
{port_specs, [ {port_specs, [
{"priv/jiffy.so", [ {"priv/jiffy.so", [
"c_src/*.c", "c_src/*.c",

+ 0
- 37
rebar.config.script 查看文件

@ -1,37 +0,0 @@
% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
% Only include PropEr as a dependency when the JIFFY_DEV
% environment variable is defined. This allows downstream
% applications to avoid requiring PropEr.
%
% This script is based on the example provided with Rebar.
ErlOpts = [{d, 'JIFFY_DEV'}],
Proper = [
{proper, ".*", {git, "git://github.com/manopapad/proper.git", "master"}}
],
ConfigPath = filename:dirname(SCRIPT),
DevMarker = filename:join([ConfigPath, ".jiffy.dev"]),
case filelib:is_file(DevMarker) orelse os:getenv("TRAVIS") == "true" of
true ->
% Don't override existing dependencies
Config0 = case lists:keyfind(deps, 1, CONFIG) of
false ->
CONFIG ++ [{deps, Proper}];
{deps, DepsList} ->
lists:keyreplace(deps, 1, CONFIG, {deps, DepsList ++ Proper})
end,
Config1 = case lists:keyfind(erl_opts, 1, Config0) of
false ->
Config0 ++ [{erl_opts, ErlOpts}];
{erl_opts, Opts} ->
NewOpts = {erl_opts, Opts ++ ErlOpts},
lists:keyreplace(erl_opts, 1, Config0, NewOpts)
end;
false ->
CONFIG
end.

+ 7
- 15
test/jiffy_11_proper_tests.erl 查看文件

@ -3,21 +3,15 @@
-module(jiffy_11_proper_tests). -module(jiffy_11_proper_tests).
-ifdef(JIFFY_DEV).
-include_lib("proper/include/proper.hrl").
-include_lib("triq/include/triq.hrl").
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-include("jiffy_util.hrl"). -include("jiffy_util.hrl").
opts() ->
[
{max_size, 15},
{numtests, 1000}
].
run(Name) -> run(Name) ->
{msg("~s", [Name]), [ {msg("~s", [Name]), [
{timeout, 300, ?_assert(proper:quickcheck(?MODULE:Name(), opts()))}
{timeout, 300, ?_assert(triq:check(?MODULE:Name(), 10))}
]}. ]}.
proper_encode_decode_test_() -> proper_encode_decode_test_() ->
@ -105,7 +99,7 @@ json_boolean() ->
json_number() -> json_number() ->
oneof([integer(), float()]).
oneof([int(), real()]).
json_string() -> json_string() ->
@ -117,7 +111,7 @@ json_list(S) when S =< 0 ->
json_list(S) -> json_list(S) ->
?LETSHRINK( ?LETSHRINK(
[ListSize], [ListSize],
[integer(0, S)],
[int(0, S)],
vector(ListSize, json_text(S - ListSize)) vector(ListSize, json_text(S - ListSize))
). ).
@ -127,7 +121,7 @@ json_object(S) when S =< 0 ->
json_object(S) -> json_object(S) ->
?LETSHRINK( ?LETSHRINK(
[ObjectSize], [ObjectSize],
[integer(0, S)],
[int(0, S)],
{vector(ObjectSize, {json_string(), json_text(S - ObjectSize)})} {vector(ObjectSize, {json_string(), json_text(S - ObjectSize)})}
). ).
@ -142,7 +136,7 @@ json_value() ->
json_text(S) when S > 0 -> json_text(S) when S > 0 ->
?LAZY(oneof([
?DELAY(oneof([
json_list(S), json_list(S),
json_object(S) json_object(S)
])); ]));
@ -172,7 +166,7 @@ escaped_utf8_bin() ->
escaped_char() -> escaped_char() ->
?LET(C, char(),
?LET(C, unicode_char(),
case C of case C of
$" -> "\\\""; $" -> "\\\"";
C when C == 65534 -> 65533; C when C == 65534 -> 65533;
@ -181,5 +175,3 @@ escaped_char() ->
C -> C C -> C
end end
). ).
-endif.

正在加载...
取消
保存