Skip to content

Commit

Permalink
stdlib_tests: remove obsoleted tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledest committed May 1, 2024
1 parent fcf62b7 commit 64108eb
Showing 1 changed file with 4 additions and 36 deletions.
40 changes: 4 additions & 36 deletions test/stdlib_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@

dict_test() ->
D = dict:from_list([{a, 1}]),
?assert(dict:is_empty(dict:new())),
?assertNot(dict:is_empty(D)),
?assertEqual(dict:take(a, D), {1, dict:new()}),
?assertEqual(dict:take(a, dict:new()), error),
?assertEqual(dict:take(b, D), error).

orddict_test() ->
D = orddict:from_list([{3, c}, {1, a}, {2, b}]),
?assert(orddict:is_empty(orddict:new())),
?assertNot(orddict:is_empty(D)),
?assertEqual(orddict:take(1, D), {a, orddict:from_list([{3, c}, {2, b}])}),
?assertEqual(orddict:take(1, orddict:new()), error),
?assertEqual(orddict:take(4, D), error).
Expand All @@ -29,17 +25,11 @@ ordsets_test() ->
?assertNot(ordsets:is_empty(ordsets:from_list([3,1,2]))).

gb_trees_test() ->
D1 = gb_trees:from_orddict(orddict:from_list([{3, c}, {1, a}, {2, b}])),
?assertEqual({1, a, gb_trees:iterator_from(2, D1)}, gb_trees:next(gb_trees:iterator(D1))),
D2 = gb_trees:insert(a, 1, gb_trees:empty()),
?assertEqual(gb_trees:take(a, D2), {1, gb_trees:empty()}),
?assertEqual(gb_trees:take_any(a, D2), {1, gb_trees:empty()}),
D = gb_trees:from_orddict(orddict:from_list([{a, 1}])),
?assertEqual(gb_trees:take(a, D), {1, gb_trees:empty()}),
?assertEqual(gb_trees:take_any(a, D), {1, gb_trees:empty()}),
?assertEqual(gb_trees:take_any(a, gb_trees:empty()), error),
?assertEqual(gb_trees:take_any(b, D2), error).

gb_sets_test() ->
S = gb_sets:from_ordset(ordsets:from_list([3, 1, 2])),
?assertEqual({1, gb_sets:iterator_from(2, S)}, gb_sets:next(gb_sets:iterator(S))).
?assertEqual(gb_trees:take_any(b, D), error).

lists_test() ->
% search/2
Expand Down Expand Up @@ -224,28 +214,6 @@ lists_test() ->
ok.

maps_test() ->
%% update_with/3
V1 = value1,
V2 = <<"value2">>,
V3 = "value3",
Map = #{key1 => V1, key2 => V2, "key3" => V3},
Fun = fun(V) -> [V, V, {V, V}] end,
?assertMatch(#{key1 := [V1, V1, {V1, V1}]}, maps:update_with(key1, Fun, Map)),
?assertMatch(#{key2 := [V2, V2, {V2, V2}]}, maps:update_with(key2, Fun, Map)),
?assertMatch(#{"key3" := [V3, V3, {V3, V3}]}, maps:update_with("key3", Fun, Map)),
?assertError({badmap, b}, maps:update_with([a, b], a, b)),
?assertError(badarg, maps:update_with([a, b], a, #{})),
?assertError({badkey, [a, b]}, maps:update_with([a, b], Fun, #{})),
%% update_with/4
Init = 3,
?assertMatch(#{key1 := [V1, V1, {V1, V1}]}, maps:update_with(key1, Fun, Init, Map)),
?assertMatch(#{key2 := [V2, V2, {V2, V2}]}, maps:update_with(key2, Fun, Init, Map)),
?assertMatch(#{"key3" := [V3, V3, {V3, V3}]}, maps:update_with("key3", Fun, Init, Map)),
?assertMatch(#{key3 := Init}, maps:update_with(key3, Fun, Init, Map)),
?assertError({badmap, b}, maps:update_with([a, b], a, Init, b)),
?assertError(badarg, maps:update_with([a, b], a, Init, #{})),
?assertError({badmap, a}, maps:size(a)),
?assertError({badmap, <<>>}, maps:size(<<>>)),
%% iterator/1
% Small map test
M4 = #{a => 1, b => 2},
Expand Down

0 comments on commit 64108eb

Please sign in to comment.