aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/beam_utils_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-05-23 08:40:23 +0200
committerBjörn Gustavsson <[email protected]>2016-05-23 08:40:23 +0200
commitd0554c760abc10f0c90348c8d3b63ca6110c6938 (patch)
tree06d2ce826e524951002883329291c1dfa9c6199f /lib/compiler/test/beam_utils_SUITE.erl
parentde114bb8523486c0174eb763b939fbdb34aa9421 (diff)
parent69dd6018b7731becda651393b837639746aa63c7 (diff)
downloadotp-d0554c760abc10f0c90348c8d3b63ca6110c6938.tar.gz
otp-d0554c760abc10f0c90348c8d3b63ca6110c6938.tar.bz2
otp-d0554c760abc10f0c90348c8d3b63ca6110c6938.zip
Merge branch 'bjorn/compiler/misc'
* bjorn/compiler/misc: beam_bool_SUITE: Cover one more line beam_utils_SUITE: Cover more lines in beam_utils beam_reorder: Don't confuse beam_validator beam_bool: Reject potentially unsafe optimization v3_core: Don't depend on sys_core_fold for cleaning up beam_type: Eliminate crash beam_type: Correct handling of setelement/3 beam_validator: Handle cons literals better beam_validator: Keep better track of tuple literals
Diffstat (limited to 'lib/compiler/test/beam_utils_SUITE.erl')
-rw-r--r--lib/compiler/test/beam_utils_SUITE.erl47
1 files changed, 45 insertions, 2 deletions
diff --git a/lib/compiler/test/beam_utils_SUITE.erl b/lib/compiler/test/beam_utils_SUITE.erl
index 6353ed3242..ae813d563b 100644
--- a/lib/compiler/test/beam_utils_SUITE.erl
+++ b/lib/compiler/test/beam_utils_SUITE.erl
@@ -23,7 +23,7 @@
init_per_group/2,end_per_group/2,
apply_fun/1,apply_mf/1,bs_init/1,bs_save/1,
is_not_killed/1,is_not_used_at/1,
- select/1,y_catch/1,otp_8949_b/1,liveopt/1]).
+ select/1,y_catch/1,otp_8949_b/1,liveopt/1,coverage/1]).
-export([id/1]).
suite() -> [{ct_hooks,[ts_install_cth]}].
@@ -43,7 +43,8 @@ groups() ->
select,
y_catch,
otp_8949_b,
- liveopt
+ liveopt,
+ coverage
]}].
init_per_suite(Config) ->
@@ -268,6 +269,48 @@ liveopt_fun(Peer, Cause, Origin) ->
void
end.
+%% Thanks to QuickCheck.
+coverage(_Config) ->
+ 42+7 = merchant([[],7,false]),
+
+ {'EXIT',{{try_clause,0},_}} = (catch resulting([0], stone)),
+ 0.0 = resulting([true], stone),
+
+ {'EXIT',{if_clause,_}} = (catch clinic(false)),
+ {'EXIT',{{try_clause,"trials"},_}} = (catch clinic(true)),
+
+ {'EXIT',{function_clause,_}} = (catch town(overall, {{abc},alcohol})),
+
+ ok.
+
+%% Cover check_liveness/3.
+merchant([Merchant, Laws, Electric]) ->
+ id(42),
+ oklahoma([[] || 0 <- Merchant],
+ if true; Electric -> Laws end) + 42.
+oklahoma([], Int) -> Int.
+
+town(overall, {{If}, Healing = alcohol})
+ when Healing#{[] => Healing}; include ->
+ [If || Healing <- awareness].
+
+%% Cover is_reg_used_at/3.
+resulting([Conservation], stone) ->
+ try 0 of
+ Conservation when Conservation -> Conservation;
+ _ when Conservation; 0 -> 0.0
+ after
+ Conservation
+ end.
+
+%% Cover is_reg_used_at_1/3.
+clinic(Damage) ->
+ if
+ Damage ->
+ try "trials" of Damage when Damage -> Damage catch true -> [] end
+ end,
+ carefully.
+
%% The identity function.
id(I) -> I.