Skip to content

Commit

Permalink
K2InformaticsGmbH#308 Added unit test for testing behaviour of filter…
Browse files Browse the repository at this point in the history
… compilation for ['*'] case
  • Loading branch information
piosok committed Jan 16, 2020
1 parent c202cd0 commit f8acd75
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/imem_snap.erl
Original file line number Diff line number Diff line change
Expand Up @@ -1452,6 +1452,42 @@ f2mc_test_() ->
]
}.

filters2ms_test_() ->
{
inparallel,
[{
lists:flatten(io_lib:format("~s : ~p", [Title, Filter])),
fun() ->
case catch filters2ms(true,Filter) of
{'EXIT', Exception} ->
?debugFmt(
"~n~s : imem_snap:filters2ms(true,~p).~n"
"Expected : ~p~n"
"Exception : ~p",
[Title, Filter, MatchSpec, Exception]
),
error(failed);
CalculatedMs ->
if CalculatedMs /= MatchSpec ->
?debugFmt(
"~n~s : imem_snap:filters2ms(~p, '$1').~n"
"Expected : ~p~n"
"Got : ~p",
[Title, Filter, MatchSpec, CalculatedMs]
);
true -> ok
end,
?assertEqual(MatchSpec, CalculatedMs)
end
end
} || {Title, Filter, MatchSpec} <- [
{"all", ['*'], [{#{ckey => '$1'},[],['$_']}]},
{"list all", [['*']], [{#{ckey => '$1'},[{is_list,'$1'}],['$_']}] },
{"all tuple", [{'*'}], [{#{ckey => '$1'},[{is_tuple,'$1'}],['$_']}]}
]
]
}.

msrun_test_() ->
Rows = [
["a"],
Expand Down

0 comments on commit f8acd75

Please sign in to comment.