Skip to content

Commit

Permalink
accept 0 rate in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Dec 7, 2023
1 parent 6fd7de3 commit 79dba51
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/opuntia_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
init_per_testcase/2,
end_per_testcase/2]).

-include_lib("stdlib/include/assert.hrl").
-include_lib("proper/include/proper.hrl").

all() ->
Expand All @@ -23,6 +24,7 @@ groups() ->
[
{throughput_throttle, [parallel],
[
run_shaper_with_zero_does_not_shape,
run_basic_shaper_property
]}
].
Expand Down Expand Up @@ -54,6 +56,18 @@ end_per_testcase(_TestCase, _Config) ->
%%% Individual Test Cases (from groups() definition)
%%%===================================================================

run_shaper_with_zero_does_not_shape(_) ->
Prop = ?FORALL(
TokensToSpend,
integer(1, 9999),
begin
Shaper = opuntia:new(0),
{TimeUs, _LastShaper} = timer:tc(fun run_shaper/2, [Shaper, TokensToSpend]),
TimeMs = erlang:convert_time_unit(TimeUs, microsecond, millisecond),
0 =< TimeMs
end),
run_prop(?FUNCTION_NAME, Prop, 100, 1).

run_basic_shaper_property(_) ->
Prop = ?FORALL(
{TokensToSpend, RatePerMs},
Expand Down

0 comments on commit 79dba51

Please sign in to comment.