aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl
diff options
context:
space:
mode:
authorMagnus Lång <[email protected]>2014-03-26 18:58:46 +0100
committerKostis Sagonas <[email protected]>2014-04-29 11:40:29 +0200
commit5a43eb383bdeb604fd8a891ffe34610c3fe6208b (patch)
tree1a76c9a5bf0d8f32c06acb8266eaa52ce6e860d5 /lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl
parente486d8b0c6124f39db6fa600f348c7bd5c0c1a13 (diff)
downloadotp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.tar.gz
otp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.tar.bz2
otp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.zip
Copy the tests for maps from the compiler application to a new HiPE test suite
Change the maps_guard_fun test to accept the HiPE trace format.
Diffstat (limited to 'lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl')
-rw-r--r--lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl b/lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl
new file mode 100644
index 0000000000..61a0eaa1e7
--- /dev/null
+++ b/lib/hipe/test/maps_SUITE_data/maps_guard_bifs.erl
@@ -0,0 +1,31 @@
+-module(maps_guard_bifs).
+-export([test/0]).
+
+test() ->
+ true = map_guard_empty(),
+ true = map_guard_empty_2(),
+ true = map_guard_head(#{a=>1}),
+ false = map_guard_head([]),
+ true = map_guard_body(#{a=>1}),
+ false = map_guard_body({}),
+ true = map_guard_pattern(#{a=>1, <<"hi">> => "hi" }),
+ false = map_guard_pattern("list"),
+ true = map_guard_tautology(),
+ true = map_guard_ill_map_size(),
+ ok.
+
+map_guard_empty() when is_map(#{}); false -> true.
+
+map_guard_empty_2() when true; #{} andalso false -> true.
+
+map_guard_head(M) when is_map(M) -> true;
+map_guard_head(_) -> false.
+
+map_guard_body(M) -> is_map(M).
+
+map_guard_pattern(#{}) -> true;
+map_guard_pattern(_) -> false.
+
+map_guard_tautology() when #{} =:= #{}; true -> true.
+
+map_guard_ill_map_size() when true; map_size(0) -> true.