aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-114/lance-wicks/perl/lib/Palindrome.pm13
-rw-r--r--challenge-114/lance-wicks/perl/t/00-palindrome.t12
2 files changed, 25 insertions, 0 deletions
diff --git a/challenge-114/lance-wicks/perl/lib/Palindrome.pm b/challenge-114/lance-wicks/perl/lib/Palindrome.pm
new file mode 100644
index 0000000000..c0e9c2bfe8
--- /dev/null
+++ b/challenge-114/lance-wicks/perl/lib/Palindrome.pm
@@ -0,0 +1,13 @@
+package Palindrome;
+
+sub num {
+ my ( $self, $N ) = @_;
+
+ my $counter = $N + 1;
+ while ( $counter ne reverse $counter ) {
+ $counter++;
+ }
+ return $counter;
+}
+
+1;
diff --git a/challenge-114/lance-wicks/perl/t/00-palindrome.t b/challenge-114/lance-wicks/perl/t/00-palindrome.t
new file mode 100644
index 0000000000..b398f3c977
--- /dev/null
+++ b/challenge-114/lance-wicks/perl/t/00-palindrome.t
@@ -0,0 +1,12 @@
+use Test2::V0 -target => 'Palindrome';
+
+my @cases
+ = ( [ 1, 2 ], [ 9, 11 ], [ 99, 101 ], [ 999, 1001 ], [ 1234, 1331 ], );
+
+for my $pair (@cases) {
+ my $got = $CLASS->num( $pair->[0] );
+ is $got, $pair->[1], "$pair->[0] \t Expect: $pair->[1] \t\t Got: $got";
+
+}
+
+done_testing;