First we'll check if the fibonacci function works correctly even when called with negative numbers.

examples/perl/t/fibonacci_negative.t

use strict; use warnings; use Test::More tests => 1; use lib 'lib'; use MyTools; { my $result = fibonacci(-1); is($result, 0, 'fibonacci on -1 returns 0'); }

examples/perl/t/fibonacci_negative.out

1..1 Given number must be > 0 at lib/MyTools.pm line 19. ok 1 - fibonacci on -1 returns 0

In the above code the tests are passing but there is a warning as well. This is an expected warning so we don't need to worry about it. But then again people or code using our module might start to rely on this warning. We would like to make sure it won't disappear or change by mistake.