diff options
author | Kostis Sagonas <[email protected]> | 2014-04-29 12:14:19 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2014-04-29 12:14:19 +0200 |
commit | f6d5234c391a0ba834337c3e92ee5fb377834a32 (patch) | |
tree | b046b684620ca9eab0e3f880a7ee34c1e6397d17 /lib/hipe/test/maps_SUITE_data/maps_is_map.erl | |
parent | 5a43eb383bdeb604fd8a891ffe34610c3fe6208b (diff) | |
download | otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.tar.gz otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.tar.bz2 otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.zip |
Add five new test files for maps in the HiPE test suite
Diffstat (limited to 'lib/hipe/test/maps_SUITE_data/maps_is_map.erl')
-rw-r--r-- | lib/hipe/test/maps_SUITE_data/maps_is_map.erl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/hipe/test/maps_SUITE_data/maps_is_map.erl b/lib/hipe/test/maps_SUITE_data/maps_is_map.erl new file mode 100644 index 0000000000..e84f4b8c44 --- /dev/null +++ b/lib/hipe/test/maps_SUITE_data/maps_is_map.erl @@ -0,0 +1,24 @@ +%% -*- erlang-indent-level: 2 -*- +%%------------------------------------------------------------------------- +-module(maps_is_map). + +-export([test/0]). + +test() -> + true = test_is_map(#{}), + false = test_is_map(<<"hej">>), + true = test_is_map_guard(#{a => b}), + false = test_is_map_guard(3), + true = test_is_map_with_binary_guard(#{"a" => <<"b">>}), + false = test_is_map_with_binary_guard(12), + ok. + +test_is_map(X) -> + is_map(X). + +test_is_map_guard(Map) when is_map(Map) -> true; +test_is_map_guard(_) -> false. + +test_is_map_with_binary_guard(B) when is_binary(B) -> false; +test_is_map_with_binary_guard(#{}) -> true; +test_is_map_with_binary_guard(_) -> false. |