Fix tests to run with Triq
authorNick Vatamaniuc <vatamane@apache.org>
Wed, 30 May 2018 23:15:40 +0000 (19:15 -0400)
committerNick Vatamaniuc <vatamane@apache.org>
Wed, 30 May 2018 23:15:40 +0000 (19:15 -0400)
Used CouchDB's Triq port

Had to uncomment a bunch of bisect module checks. That made the diff kind of
ugly.

rebar-test.config
rebar.config
src/hyper.erl
test/hyper_test.erl

index 160b729..b0d4b15 100644 (file)
@@ -1,9 +1,4 @@
 {cover_enabled, true}.
 {deps, [
-        {basho_stats, "",
-         {git, "https://github.com/knutin/basho_stats.git", {branch, "master"}}},
-        {proper, "",
-         {git,"https://github.com/manopapad/proper.git", "master"}},
-        {stdlib2, "",
-         {git, "git://github.com/cannedprimates/stdlib2.git", {branch, "master"}}}
+         {triq, "", {git, "https://github.com/apache/couchdb-triq", {tag, "v1.2.0"}}}
        ]}.
index 0382632..dc56e0e 100644 (file)
@@ -1,5 +1,9 @@
 {cover_enabled, true}.
 
+{deps, [
+         {triq, "", {git, "https://github.com/apache/couchdb-triq", {tag, "v1.2.0"}}}
+       ]}.
+
 {port_specs, [
               {"priv/hyper_carray.so", ["c_src/hyper_carray.c"]}
              ]}.
index e7c80f2..485b988 100644 (file)
@@ -311,7 +311,7 @@ perf_report() ->
     Ps      = [15],
     Cards   = [1, 100, 500, 1000, 2500, 5000, 10000,
                15000, 25000, 50000, 100000, 1000000],
-    Mods    = [hyper_gb, hyper_array, hyper_bisect, hyper_binary, hyper_carray],
+    Mods    = [hyper_gb, hyper_array,hyper_binary, hyper_carray],
     Repeats = 10,
 
     Time = fun (F, Args) ->
index 18d2a87..3523da0 100644 (file)
@@ -1,17 +1,14 @@
 -module(hyper_test).
--include_lib("proper/include/proper.hrl").
+-include_lib("triq/include/triq.hrl").
 -include_lib("eunit/include/eunit.hrl").
 
 -record(hyper, {p, registers}). % copy of #hyper in hyper.erl
 
 hyper_test_() ->
-    ProperOpts = [{max_size, 1000},
-                  {numtests, 100},
-                  {to_file, user}],
     RunProp = fun (P) ->
                       {timeout, 600,
                        fun () ->
-                               ?assert(proper:quickcheck(P, ProperOpts))
+                               ?assert(triq:check(P))
                        end}
               end,
 
@@ -34,7 +31,7 @@ hyper_test_() ->
       {"Union property with hyper_carry", RunProp(prop_union(hyper_carray))},
       {"Union property with hyper_binary", RunProp(prop_union(hyper_binary))},
       {"Union property with hyper_array", RunProp(prop_union(hyper_array))},
-      {"Union property with hyper_bisect", RunProp(prop_union(hyper_bisect))},
+      %{"Union property with hyper_bisect", RunProp(prop_union(hyper_bisect))},
       {"Union property with hyper_gb", RunProp(prop_union(hyper_gb))},
       RunProp(prop_set()),
       RunProp(prop_serialize())
@@ -89,13 +86,13 @@ backend_t() ->
 
     Gb     = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_gb))),
     Array  = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_array))),
-    Bisect = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_bisect))),
+    %Bisect = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_bisect))),
     Binary = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_binary))),
     Carray = hyper:compact(hyper:insert_many(Values, hyper:new(P, hyper_carray))),
 
     {hyper_gb    , GbRegisters}     = Gb#hyper.registers,
     {hyper_array , ArrayRegisters}  = Array#hyper.registers,
-    {hyper_bisect, BisectRegisters} = Bisect#hyper.registers,
+    %{hyper_bisect, BisectRegisters} = Bisect#hyper.registers,
     {hyper_binary, BinaryRegisters} = Binary#hyper.registers,
     {hyper_carray, CarrayRegisters} = Carray#hyper.registers,
 
@@ -126,25 +123,25 @@ backend_t() ->
 
     ?assertEqual(ExpectedBytes, hyper_gb:encode_registers(GbRegisters)),
     ?assertEqual(ExpectedBytes, hyper_array:encode_registers(ArrayRegisters)),
-    ?assertEqual(ExpectedBytes, hyper_bisect:encode_registers(BisectRegisters)),
+    %?assertEqual(ExpectedBytes, hyper_bisect:encode_registers(BisectRegisters)),
     ?assertEqual(ExpectedBytes, hyper_binary:encode_registers(BinaryRegisters)),
     ?assertEqual(ExpectedBytes, hyper_carray:encode_registers(CarrayRegisters)),
 
     ?assertEqual(hyper:card(Gb),
                  hyper:card(hyper:from_json(hyper:to_json(Array), hyper_gb))),
     ?assertEqual(Array, hyper:from_json(hyper:to_json(Array), hyper_array)),
-    ?assertEqual(Bisect, hyper:from_json(hyper:to_json(Array), hyper_bisect)),
+    %?assertEqual(Bisect, hyper:from_json(hyper:to_json(Array), hyper_bisect)),
     ?assertEqual(Binary, hyper:from_json(hyper:to_json(Binary), hyper_binary)),
     ?assertEqual(Carray, hyper:from_json(hyper:to_json(Carray), hyper_carray)),
 
 
     ?assertEqual(hyper:to_json(Gb), hyper:to_json(Array)),
-    ?assertEqual(hyper:to_json(Gb), hyper:to_json(Bisect)),
+    %?assertEqual(hyper:to_json(Gb), hyper:to_json(Bisect)),
     ?assertEqual(hyper:to_json(Gb), hyper:to_json(Binary)),
     ?assertEqual(hyper:to_json(Gb), hyper:to_json(Carray)),
 
     ?assertEqual(hyper:card(Gb), hyper:card(Array)),
-    ?assertEqual(hyper:card(Gb), hyper:card(Bisect)),
+    %?assertEqual(hyper:card(Gb), hyper:card(Bisect)),
     ?assertEqual(hyper:card(Gb), hyper:card(Binary)),
     ?assertEqual(hyper:card(Gb), hyper:card(Carray)).
 
@@ -305,11 +302,11 @@ small_big_union_t() ->
     BigSet   = sets:from_list(generate_unique(BigCard)),
 
     SmallHyper = hyper:insert_many(sets:to_list(SmallSet),
-                                   hyper:new(15, hyper_bisect)),
+                                   hyper:new(15)),
     BigHyper   = hyper:insert_many(sets:to_list(BigSet),
-                                   hyper:new(15, hyper_bisect)),
-    ?assertMatch({hyper_bisect, {sparse, _, _, _}}, SmallHyper#hyper.registers),
-    ?assertMatch({hyper_bisect, {dense, _}}, BigHyper#hyper.registers),
+                                   hyper:new(15)),
+    %?assertMatch({hyper_bisect, {sparse, _, _, _}}, SmallHyper#hyper.registers),
+    %?assertMatch({hyper_bisect, {dense, _}}, BigHyper#hyper.registers),
 
     UnionHyper = hyper:union(SmallHyper, BigHyper),
     TrueUnion = sets:size(sets:union(SmallSet, BigSet)),
@@ -379,7 +376,7 @@ bad_serialization_t() ->
 %%
 
 backends() ->
-    [hyper_gb, hyper_array, hyper_bisect, hyper_binary, hyper_carray].
+    [hyper_gb, hyper_array, hyper_binary, hyper_carray].
 
 
 gen_values() ->