aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/test/basic_SUITE_data/basic_switches.erl
diff options
context:
space:
mode:
authorKostis Sagonas <[email protected]>2015-11-30 23:36:42 +0100
committerKostis Sagonas <[email protected]>2015-12-16 22:08:34 +0100
commita0286ce52c775812e499c4f036033daa5ffe4676 (patch)
treea869bb47e0131c4100d581a555ad5d72d172bbf5 /lib/hipe/test/basic_SUITE_data/basic_switches.erl
parent186868ede408e714afe191c0a40123e4f8b2e847 (diff)
downloadotp-a0286ce52c775812e499c4f036033daa5ffe4676.tar.gz
otp-a0286ce52c775812e499c4f036033daa5ffe4676.tar.bz2
otp-a0286ce52c775812e499c4f036033daa5ffe4676.zip
Include some more old HiPE tests to the test suite
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data/basic_switches.erl')
-rw-r--r--lib/hipe/test/basic_SUITE_data/basic_switches.erl52
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/hipe/test/basic_SUITE_data/basic_switches.erl b/lib/hipe/test/basic_SUITE_data/basic_switches.erl
new file mode 100644
index 0000000000..0a7ae5b8b7
--- /dev/null
+++ b/lib/hipe/test/basic_SUITE_data/basic_switches.erl
@@ -0,0 +1,52 @@
+%%% -*- erlang-indent-level: 2 -*-
+%%%-------------------------------------------------------------------
+%%% Author: Kostis Sagonas
+%%%
+%%% Contains tests for pattern matching switches.
+%%%-------------------------------------------------------------------
+-module(basic_switches).
+
+-export([test/0]).
+
+test() ->
+ ok = test_switch_mix(),
+ ok.
+
+%%---------------------------------------------------------------------
+
+-define(BIG1, 21323233222132323322).
+-define(BIG2, 4242424242424242424242424242424242).
+
+test_switch_mix() ->
+ small1 = t(42),
+ small2 = t(17),
+ big1 = t(?BIG1),
+ big2 = t(?BIG2),
+ atom = t(foo),
+ pid = t(self()),
+ float = t(4.2),
+ ok.
+
+t(V) ->
+ S = self(),
+ case V of
+ 42 -> small1;
+ 17 -> small2;
+ ?BIG1 -> big1;
+ ?BIG2 -> big2;
+ 1 -> no;
+ 2 -> no;
+ 3 -> no;
+ 4 -> no;
+ 5 -> no;
+ 6 -> no;
+ 7 -> no;
+ 8 -> no;
+ foo -> atom;
+ 9 -> no;
+ 4.2 -> float;
+ S -> pid;
+ _ -> no
+ end.
+
+%%---------------------------------------------------------------------