arkdro avatar arkdro committed 3012f95

add do_compare config parameter

Comments (0)

Files changed (2)

erlang/test/num_SUITE.erl

     Res2 = decimal:multiply(D1, D2, ?d_context),
     {Res1, Res2}.
 
-compare({ok, R1}, R1) ->
+compare(R1, R2) ->
+    Do_compare = ct:get_config(do_compare, true),
+    do_compare(Do_compare, {ok, R1}, R1).
+
+do_compare(false, {ok, R1}, R1) ->
+    true;
+do_compare(true, {ok, R1}, R1) ->
     Verbose = ct:get_config(verbose, 0),
     if Verbose > 3 ->
-            ct:pal("compare equal match~nr1=~p~n", [R1]);
+            ct:pal("do_compare equal match~nr1=~p~n", [R1]);
        true ->
             ok
     end,
     true;
-compare({ok, R1}, R2) ->
+do_compare(true, {ok, R1}, R2) ->
     case decimal:compare(R1, R2, ?d_context) of
         0 ->
             Verbose = ct:get_config(verbose, 0),
             if Verbose > 3 ->
-                    ct:pal("compare equal~nr1=~p~nr2=~p~n", [R1, R2]);
+                    ct:pal("do_compare equal~nr1=~p~nr2=~p~n", [R1, R2]);
                true ->
                     ok
             end,
             true;
         _ ->
-            compare2(R1, R2)
+            do_compare2(R1, R2)
     end;
-compare(R1, R2) ->
-    ct:pal("compare different, not even close~n~p~n~p~n", [R1, R2]),
+do_compare(true, R1, R2) ->
+    ct:pal("do_compare different, not even close~n~p~n~p~n", [R1, R2]),
     false.
 
 %% this is necessary for divide only
-compare2({_S1, _M1, E1} = R1, {_S2, _M2, E2} = R2) ->
+do_compare2({_S1, _M1, E1} = R1, {_S2, _M2, E2} = R2) ->
     {_Ds, Dm, De} = decimal:subtract(R1, R2),
     Min_exp = min(E1, E2),
     if (Dm =< 1) and (De =< Min_exp) ->
             Verbose = ct:get_config(verbose, 0),
             if Verbose > 3 ->
-                    ct:pal("compare almost equal~nr1=~p~nr2=~p~n", [R1, R2]);
+                    ct:pal("do_compare2 almost equal~nr1=~p~nr2=~p~n", [R1, R2]);
                true ->
                     ok
             end,
             true;
        true ->
-            ct:pal("compare different~n~p~n~p~n", [R1, R2]),
+            ct:pal("do_compare2 different~n~p~n~p~n", [R1, R2]),
             false
     end.
 

erlang/test/test.config

 {mantissa_min, 0}.
 {mantissa_max, 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999}.
 
+{do_compare, true}.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.