Alexander Shorin před 9 roky
rodič
revize
c6dfb9b989
3 změnil soubory, kde provedl 11 přidání a 52 odebrání
  1. +4
    -0
      rebar.config
  2. +0
    -37
      rebar.config.script
  3. +7
    -15
      test/jiffy_11_proper_tests.erl

+ 4
- 0
rebar.config Zobrazit soubor

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

+ 0
- 37
rebar.config.script Zobrazit soubor

@ -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 Zobrazit soubor

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

Načítá se…
Zrušit
Uložit