hydra/t/Hydra/Math.t
Graham Christensen a5d1d36fa6 Tests: restructure to more closely mirror the sources
t/ had lots of directories and files mirroring src/lib/Hydra. This moves
those files under t/Hydra
2022-01-10 15:34:52 -05:00

20 lines
481 B
Perl

use strict;
use warnings;
use Setup;
use Hydra::Math qw(exponential_backoff);
use Test2::V0;
subtest "exponential_backoff" => sub {
is(exponential_backoff(0), 1);
is(exponential_backoff(1), 2);
is(exponential_backoff(2), 4);
is(exponential_backoff(9), 512);
is(exponential_backoff(10), 1024);
is(exponential_backoff(11), 1024, "we're clamped to 1024 seconds");
is(exponential_backoff(11000), 1024, "we're clamped to 1024 seconds");
};
done_testing;