Skip to content
Browse files

Ets all option tests

  • Loading branch information...
1 parent bc7ec6c commit 6f562ab2d7419386f0ae0db9682fc93d642d0403 Gianfranco committed
Showing with 23 additions and 5 deletions.
  1. +9 −2 src/frame_axiom.erl
  2. +14 −3 test/frame_axiom_tests.erl
View
11 src/frame_axiom.erl
@@ -51,7 +51,9 @@ snapshot(Ets,{application,all}) ->
snapshot(Ets,{application,Options}) when is_list(Options) ->
lists:foldl(fun(Option,EtsAcc) -> snapshot(EtsAcc,application,Option)
end,Ets,Options);
-snapshot(Ets,{ets,Options}) ->
+snapshot(Ets,{ets,all}) ->
+ snapshot(Ets,{ets,all(ets)});
+snapshot(Ets,{ets,Options}) when is_list(Options) ->
lists:foldl(fun(Option,EtsAcc) -> snapshot(EtsAcc,ets,Option)
end,Ets,Options);
@@ -156,6 +158,8 @@ diff(Ets,{application,all}) ->
diff(Ets,{application,Options}) when is_list(Options) ->
lists:foldl(fun(Option,Res) -> Res++diff(Ets,application,Option)
end,[],Options);
+diff(Ets,{ets,all}) ->
+ diff(Ets,{ets,all(ets)});
diff(Ets,{ets,Options}) when is_list(Options) ->
lists:foldl(fun(Option,Res) -> Res++diff(Ets,ets,Option)
end,[],Options);
@@ -295,7 +299,10 @@ all(process) ->
[creation,death,received_messages,consumed_messages,
creation_named,death_named,replaced_named];
all(application) ->
- [loaded,unloaded,started,stopped].
+ [loaded,unloaded,started,stopped];
+all(ets) ->
+ [creation,deletion].
+
collect(ExactP,Path) ->
case filelib:is_dir(Path) of
View
17 test/frame_axiom_tests.erl
@@ -198,9 +198,20 @@ ets_delection_diff_test() ->
ets:delete(E),
?assertEqual([{deleted,E}],frame_axiom:diff(Ref,[{ets,Options}])).
-ets_no_change_test() ->
- Ref = frame_axiom:snapshot(ets),
- ?assertEqual([],frame_axiom:diff(Ref,ets)).
+ets_all_no_change_test() ->
+ Options = all,
+ Ref = frame_axiom:snapshot([{ets,Options}]),
+ ?assertEqual([],frame_axiom:diff(Ref,[{ets,Options}])).
+
+ets_all_change_test() ->
+ Options = all,
+ D = ets:new(some,[]),
+ Ref = frame_axiom:snapshot([{ets,Options}]),
+ C = ets:new(other,[]),
+ ets:delete(D),
+ ?assertEqual([{created,C},
+ {deleted,D}],
+ frame_axiom:diff(Ref,[{ets,Options}])).
%% port
%% ---------------------------------------------------------

0 comments on commit 6f562ab

Please sign in to comment.
Something went wrong with that request. Please try again.