diff options
author | Zandra <[email protected]> | 2016-01-27 11:44:59 +0100 |
---|---|---|
committer | Zandra <[email protected]> | 2016-01-27 11:44:59 +0100 |
commit | f0b7d4797b13a90b4dcee40468a5675a73feb1d4 (patch) | |
tree | 44e2832bbe7e7a0c1deaa6bd8685d3d03713a2b2 /lib/hipe/test/basic_SUITE_data/basic_switches.erl | |
parent | 6b6828e51300e318b8a3a572b6a5d78ca3756d79 (diff) | |
parent | 9722388b2fcec9b7f7e5680335e1bd6392ef11fc (diff) | |
download | otp-f0b7d4797b13a90b4dcee40468a5675a73feb1d4.tar.gz otp-f0b7d4797b13a90b4dcee40468a5675a73feb1d4.tar.bz2 otp-f0b7d4797b13a90b4dcee40468a5675a73feb1d4.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/hipe/test/basic_SUITE_data/basic_switches.erl')
-rw-r--r-- | lib/hipe/test/basic_SUITE_data/basic_switches.erl | 52 |
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. + +%%--------------------------------------------------------------------- |