aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/test/erl_match_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erl_interface/test/erl_match_SUITE.erl')
-rw-r--r--lib/erl_interface/test/erl_match_SUITE.erl295
1 files changed, 144 insertions, 151 deletions
diff --git a/lib/erl_interface/test/erl_match_SUITE.erl b/lib/erl_interface/test/erl_match_SUITE.erl
index ecdebad212..07122f2edf 100644
--- a/lib/erl_interface/test/erl_match_SUITE.erl
+++ b/lib/erl_interface/test/erl_match_SUITE.erl
@@ -24,10 +24,10 @@
-include_lib("common_test/include/ct.hrl").
-include("erl_match_SUITE_data/match_test_cases.hrl").
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2,
- atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1,
- bind/1, integers/1, floats/1, binaries/1, strings/1]).
+-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
+ init_per_group/2,end_per_group/2,
+ atoms/1, lists/1, tuples/1, references/1, pids/1, ports/1,
+ bind/1, integers/1, floats/1, binaries/1, strings/1]).
%% For interactive running of matcher.
-export([start_matcher/1, erl_match/3]).
@@ -58,212 +58,210 @@ end_per_group(_GroupName, Config) ->
atoms(suite) -> [];
atoms(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line eq(P, '', ''),
- ?line eq(P, a, a),
- ?line ne(P, a, b),
- ?line ne(P, a, aa),
- ?line eq(P, kalle, kalle),
- ?line ne(P, kalle, arne),
+ eq(P, '', ''),
+ eq(P, a, a),
+ ne(P, a, b),
+ ne(P, a, aa),
+ eq(P, kalle, kalle),
+ ne(P, kalle, arne),
- ?line ne(P, kalle, 42),
- ?line ne(P, 42, kalle),
+ ne(P, kalle, 42),
+ ne(P, 42, kalle),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
lists(suite) -> [];
lists(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line eq(P, [], []),
+ P = start_matcher(Config),
+ eq(P, [], []),
- ?line ne(P, [], [a]),
- ?line ne(P, [a], []),
+ ne(P, [], [a]),
+ ne(P, [a], []),
- ?line eq(P, [a], [a]),
- ?line ne(P, [a], [b]),
+ eq(P, [a], [a]),
+ ne(P, [a], [b]),
- ?line eq(P, [a|b], [a|b]),
- ?line ne(P, [a|b], [a|x]),
+ eq(P, [a|b], [a|b]),
+ ne(P, [a|b], [a|x]),
- ?line eq(P, [a, b], [a, b]),
- ?line ne(P, [a, b], [a, x]),
+ eq(P, [a, b], [a, b]),
+ ne(P, [a, b], [a, x]),
- ?line eq(P, [a, b, c], [a, b, c]),
- ?line ne(P, [a, b|c], [a, b|x]),
- ?line ne(P, [a, b, c], [a, b, x]),
- ?line ne(P, [a, b|c], [a, b|x]),
- ?line ne(P, [a, x|c], [a, b|c]),
- ?line ne(P, [a, b, c], [a, x, c]),
+ eq(P, [a, b, c], [a, b, c]),
+ ne(P, [a, b|c], [a, b|x]),
+ ne(P, [a, b, c], [a, b, x]),
+ ne(P, [a, b|c], [a, b|x]),
+ ne(P, [a, x|c], [a, b|c]),
+ ne(P, [a, b, c], [a, x, c]),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
tuples(suite) -> [];
tuples(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line ne(P, {}, {a, b}),
- ?line ne(P, {a, b}, {}),
- ?line ne(P, {a}, {a, b}),
- ?line ne(P, {a, b}, {a}),
+ ne(P, {}, {a, b}),
+ ne(P, {a, b}, {}),
+ ne(P, {a}, {a, b}),
+ ne(P, {a, b}, {a}),
- ?line eq(P, {}, {}),
+ eq(P, {}, {}),
- ?line eq(P, {a}, {a}),
- ?line ne(P, {a}, {b}),
+ eq(P, {a}, {a}),
+ ne(P, {a}, {b}),
- ?line eq(P, {1}, {1}),
- ?line ne(P, {1}, {2}),
+ eq(P, {1}, {1}),
+ ne(P, {1}, {2}),
- ?line eq(P, {a, b}, {a, b}),
- ?line ne(P, {x, b}, {a, b}),
+ eq(P, {a, b}, {a, b}),
+ ne(P, {x, b}, {a, b}),
- ?line ne(P, {error, x}, {error, y}),
- ?line ne(P, {error, {undefined, {subscriber, last}}},
- {error, {undefined, {subscriber, name}}}),
+ ne(P, {error, x}, {error, y}),
+ ne(P, {error, {undefined, {subscriber, last}}},
+ {error, {undefined, {subscriber, name}}}),
- ?line runner:finish(P),
+ runner:finish(P),
ok.
references(suite) -> [];
references(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Ref1 = make_ref(),
- ?line Ref2 = make_ref(),
-
- ?line eq(P, Ref1, Ref1),
- ?line eq(P, Ref2, Ref2),
- ?line ne(P, Ref1, Ref2),
- ?line ne(P, Ref2, Ref1),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Ref1 = make_ref(),
+ Ref2 = make_ref(),
+
+ eq(P, Ref1, Ref1),
+ eq(P, Ref2, Ref2),
+ ne(P, Ref1, Ref2),
+ ne(P, Ref2, Ref1),
+
+ runner:finish(P),
ok.
pids(suite) -> [];
pids(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Pid1 = c:pid(0,1,2),
- ?line Pid2 = c:pid(0,1,3),
-
- ?line eq(P, self(), self()),
- ?line eq(P, Pid1, Pid1),
- ?line ne(P, Pid1, self()),
- ?line ne(P, Pid2, Pid1),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Pid1 = c:pid(0,1,2),
+ Pid2 = c:pid(0,1,3),
+
+ eq(P, self(), self()),
+ eq(P, Pid1, Pid1),
+ ne(P, Pid1, self()),
+ ne(P, Pid2, Pid1),
+
+ runner:finish(P),
ok.
ports(suite) -> [];
ports(Config) when is_list(Config) ->
case os:type() of
- vxworks ->
- {skipped,"not on vxworks, pucko"};
- _ ->
- ?line P = start_matcher(Config),
- ?line P2 = start_matcher(Config),
-
- ?line eq(P, P, P),
- ?line ne(P, P, P2),
-
- ?line runner:finish(P),
- ?line runner:finish(P2),
- ok
+ vxworks ->
+ {skipped,"not on vxworks, pucko"};
+ _ ->
+ P = start_matcher(Config),
+ P2 = start_matcher(Config),
+
+ eq(P, P, P),
+ ne(P, P, P2),
+
+ runner:finish(P),
+ runner:finish(P2),
+ ok
end.
integers(suite) -> [];
integers(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line I1 = 123,
- ?line I2 = 12345,
- ?line I3 = -123,
- ?line I4 = 2234,
-
- ?line eq(P, I1, I1),
- ?line eq(P, I2, I2),
- ?line ne(P, I1, I2),
- ?line ne(P, I1, I3),
- ?line eq(P, I4, I4),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ I1 = 123,
+ I2 = 12345,
+ I3 = -123,
+ I4 = 2234,
+
+ eq(P, I1, I1),
+ eq(P, I2, I2),
+ ne(P, I1, I2),
+ ne(P, I1, I3),
+ eq(P, I4, I4),
+
+ runner:finish(P),
ok.
floats(suite) -> [];
floats(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line F1 = 3.1414,
- ?line F2 = 3.1415,
- ?line F3 = 3.1416,
-
- ?line S1 = "string",
- ?line S2 = "string2",
-
- ?line eq(P, F1, F1),
- ?line eq(P, F2, F2),
- ?line ne(P, F1, F2),
- ?line ne(P, F3, F2),
-
- ?line eq(P, S2, S2),
- ?line ne(P, S1, S2),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ F1 = 3.1414,
+ F2 = 3.1415,
+ F3 = 3.1416,
+
+ S1 = "string",
+ S2 = "string2",
+
+ eq(P, F1, F1),
+ eq(P, F2, F2),
+ ne(P, F1, F2),
+ ne(P, F3, F2),
+
+ eq(P, S2, S2),
+ ne(P, S1, S2),
+
+ runner:finish(P),
ok.
binaries(suite) -> [];
binaries(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
- ?line Bin1 = term_to_binary({kalle, 146015, {kungsgatan, 23}}),
- ?line Bin2 = term_to_binary(sune),
- ?line Bin3 = list_to_binary("sune"),
-
- ?line eq(P, Bin1, Bin1),
- ?line eq(P, Bin2, Bin2),
- ?line eq(P, Bin3, Bin3),
- ?line ne(P, Bin1, Bin2),
- ?line ne(P, Bin1, Bin3),
- ?line ne(P, Bin2, Bin3),
-
- ?line runner:finish(P),
+ P = start_matcher(Config),
+ Bin1 = term_to_binary({kalle, 146015, {kungsgatan, 23}}),
+ Bin2 = term_to_binary(sune),
+ Bin3 = list_to_binary("sune"),
+
+ eq(P, Bin1, Bin1),
+ eq(P, Bin2, Bin2),
+ eq(P, Bin3, Bin3),
+ ne(P, Bin1, Bin2),
+ ne(P, Bin1, Bin3),
+ ne(P, Bin2, Bin3),
+
+ runner:finish(P),
ok.
-
strings(suite) -> [];
strings(Config) when is_list(Config) ->
- ?line P = start_matcher(Config),
+ P = start_matcher(Config),
- ?line S1 = "string",
- ?line S2 = "streng",
- ?line S3 = "String",
-
- ?line eq(P, S1, S1),
- ?line ne(P, S1, S2),
- ?line ne(P, S1, S3),
+ S1 = "string",
+ S2 = "streng",
+ S3 = "String",
- ?line runner:finish(P),
- ok.
+ eq(P, S1, S1),
+ ne(P, S1, S2),
+ ne(P, S1, S3),
+ runner:finish(P),
+ ok.
bind(suite) -> [];
bind(Config) when is_list(Config) ->
- ?line P = start_bind(Config),
- ?line S = "[X,Y,Z]",
- ?line L1 = [301,302,302],
- ?line L2 = [65,66,67],
-
- ?line bind_ok(P, S, L1),
- ?line bind_ok(P, S, L2),
-
- ?line runner:finish(P),
+ P = start_bind(Config),
+ S = "[X,Y,Z]",
+ L1 = [301,302,302],
+ L2 = [65,66,67],
+
+ bind_ok(P, S, L1),
+ bind_ok(P, S, L2),
+
+ runner:finish(P),
ok.
start_bind(Config) ->
@@ -279,15 +277,12 @@ erl_bind(Port, Pattern, Term) ->
Port ! {self(), {command, [$b, Pattern, 0]}},
runner:send_term(Port, Term),
case runner:get_term(Port) of
- {term, 0} -> false;
- {term, 1} -> true
+ {term, 0} -> false;
+ {term, 1} -> true
end.
-
-
-
start_matcher(Config) ->
runner:start(?erl_match_server).
@@ -303,8 +298,6 @@ erl_match(Port, Pattern, Term) ->
runner:send_term(Port, Pattern),
runner:send_term(Port, Term),
case runner:get_term(Port) of
- {term, 0} -> false;
- {term, 1} -> true
+ {term, 0} -> false;
+ {term, 1} -> true
end.
-
-