-
Notifications
You must be signed in to change notification settings - Fork 221
Language Perl
kazk edited this page Oct 20, 2020
·
6 revisions
Beta
5.30
Test::More
(Test::Most
can be used to reduce boilerplate)
package Solution;
use 5.006;
use strict;
use warnings;
our @EXPORT = qw(add);
sub add {
my $a = shift;
my $b = shift;
return $a + $b;
}
1;
# use strict;
# use warnings;
# use Test::More;
# Instead of the above, `Test::Most` can be used instead to reduce boilerplate.
use Test::Most;
# The name of the solution package is inferred from the code.
use Solution;
subtest "add" => sub {
is(Solution::add(1, 1), 2);
};
done_testing();
Preloaded code can be provided and it will be a separate package.
12 seconds
None
None
perl