aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/opt_verify_SUITE_data/call_elim_test_branches_opt_poss.erl
blob: 12875f41af4fe5d4ba9171e77b659db266428214 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-module(call_elim_test_branches_opt_poss).

-export([test/1]).

test(A) ->
    if A > 0 ->
	    true = has_a_field(#{a=>true}),
	    true = has_a_field(#{b=>1, a=>"2"}),
	    true = has_a_field(#{a=>5, c=>4});
       A =< 0 ->
	    true = has_a_field(#{a=>q,     'A'  =>nej}),
	    true = has_a_field(#{a=>"hej", false=>true}),
	    true = has_a_field(#{a=>3})
    end,
    true = has_nil_field(#{[]         =>3,  b =>"seven"}),
    true = has_nil_field(#{"seventeen"=>17, []=>nil}),
    ok.

has_tuple_field(#{{ab, 1}:=_}) -> true;
has_tuple_field(#{}) -> false.

has_a_field(#{a:=_}) -> true;
has_a_field(#{}) -> false.

has_nil_field(#{[]:=_}) -> true;
has_nil_field(#{}) -> false.