Skip to content

Commit 795141a

Browse files
essenmichaelklishin
authored andcommitted
Remove the unused truncate module
This kind of truncation is done automatically by lager now. (cherry picked from commit 32da1e5)
1 parent 907917d commit 795141a

File tree

2 files changed

+0
-197
lines changed

2 files changed

+0
-197
lines changed

src/truncate.erl

Lines changed: 0 additions & 127 deletions
This file was deleted.

test/unit_SUITE.erl

Lines changed: 0 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ groups() ->
5757
check_shutdown_ignored
5858
]},
5959
table_codec,
60-
{truncate, [parallel], [
61-
short_examples_exactly,
62-
term_limit,
63-
large_examples_for_size
64-
]},
6560
unfold,
6661
{vm_memory_monitor, [parallel], [
6762
parse_line_linux
@@ -697,71 +692,6 @@ check_shutdown(SigStop, Iterations, ChildCount, SupTimeout) ->
697692
end,
698693
Res.
699694

700-
%% ---------------------------------------------------------------------------
701-
%% truncate.
702-
%% ---------------------------------------------------------------------------
703-
704-
short_examples_exactly(_Config) ->
705-
F = fun (Term, Exp) ->
706-
Exp = truncate:term(Term, {1, {10, 10, 5, 5}}),
707-
Term = truncate:term(Term, {100000, {10, 10, 5, 5}})
708-
end,
709-
FSmall = fun (Term, Exp) ->
710-
Exp = truncate:term(Term, {1, {2, 2, 2, 2}}),
711-
Term = truncate:term(Term, {100000, {2, 2, 2, 2}})
712-
end,
713-
F([], []),
714-
F("h", "h"),
715-
F("hello world", "hello w..."),
716-
F([[h,e,l,l,o,' ',w,o,r,l,d]], [[h,e,l,l,o,'...']]),
717-
F([a|b], [a|b]),
718-
F(<<"hello">>, <<"hello">>),
719-
F([<<"hello world">>], [<<"he...">>]),
720-
F(<<1:1>>, <<1:1>>),
721-
F(<<1:81>>, <<0:56, "...">>),
722-
F({{{{a}}},{b},c,d,e,f,g,h,i,j,k}, {{{'...'}},{b},c,d,e,f,g,h,i,j,'...'}),
723-
FSmall({a,30,40,40,40,40}, {a,30,'...'}),
724-
FSmall([a,30,40,40,40,40], [a,30,'...']),
725-
P = spawn(fun() -> receive die -> ok end end),
726-
F([0, 0.0, <<1:1>>, F, P], [0, 0.0, <<1:1>>, F, P]),
727-
P ! die,
728-
R = make_ref(),
729-
F([R], [R]),
730-
ok.
731-
732-
term_limit(_Config) ->
733-
W = erlang:system_info(wordsize),
734-
S = <<"abc">>,
735-
1 = truncate:term_size(S, 4, W),
736-
limit_exceeded = truncate:term_size(S, 3, W),
737-
case 100 - truncate:term_size([S, S], 100, W) of
738-
22 -> ok; %% 32 bit
739-
38 -> ok %% 64 bit
740-
end,
741-
case 100 - truncate:term_size([S, [S]], 100, W) of
742-
30 -> ok; %% ditto
743-
54 -> ok
744-
end,
745-
limit_exceeded = truncate:term_size([S, S], 6, W),
746-
ok.
747-
748-
large_examples_for_size(_Config) ->
749-
%% Real world values
750-
Shrink = fun(Term) -> truncate:term(Term, {1, {1000, 100, 50, 5}}) end,
751-
TestSize = fun(Term) ->
752-
true = 5000000 < size(term_to_binary(Term)),
753-
true = 500000 > size(term_to_binary(Shrink(Term)))
754-
end,
755-
TestSize(lists:seq(1, 5000000)),
756-
TestSize(recursive_list(1000, 10)),
757-
TestSize(recursive_list(5000, 20)),
758-
TestSize(gb_sets:from_list([I || I <- lists:seq(1, 1000000)])),
759-
TestSize(gb_trees:from_orddict([{I, I} || I <- lists:seq(1, 1000000)])),
760-
ok.
761-
762-
recursive_list(S, 0) -> lists:seq(1, S);
763-
recursive_list(S, N) -> [recursive_list(S div N, N-1) || _ <- lists:seq(1, S)].
764-
765695
%% ---------------------------------------------------------------------------
766696
%% vm_memory_monitor.
767697
%% ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)