Getopt-Pad
view release on metacpan or search on metacpan
is $big->coerce($huge)->bstr, $huge, 'exactly';
is $big->check('100000000000000000000'), '100000000000000000000 is smaller than the minimum of 100000000000000000001', 'bounds compare exactly';
like $big->check('1.5'), qr/is not an integer/, 'it still takes integers only';
is Getopt::Pad::Type::Int->checkSpecKeys(bigint => 1, max => '1e3'), "max must be an integer with bigint, not '1e3'", 'bigint bounds must be integers';
};
subtest 'float' => sub {
my $float = Getopt::Pad::Type::Float->new;
is $float->check('3.14'), undef, 'float ok';
like $float->check('x'), qr/not a number/, 'non-number rejected';
like $float->check('NaN'), qr/not a finite number/, 'NaN rejected';
like $float->check('-Inf'), qr/not a finite number/, 'infinity rejected';
like $float->check('1e999'), qr/'1e999' is not a finite number/, 'a value overflowing to infinity rejected';
};
subtest 'file and dir' => sub {
my $dir = tempdir(CLEANUP => 1);
my $file = "$dir/exists.txt";
open my $fh, '>', $file or die $!;
close $fh;
( run in 0.828 second using v1.01-cache-2.11-cpan-60884a8df76 )