aboutsummaryrefslogtreecommitdiff
path: root/challenge-077/abigail/test.pl
diff options
context:
space:
mode:
author冯昶 <seaker@qq.com>2020-09-21 14:20:42 +0800
committer冯昶 <seaker@qq.com>2020-09-21 14:20:42 +0800
commitbca0c362c212fc0dadc5ed7d9a5e4fa1aece4bfb (patch)
tree877181cfde26b706346d3468269e4674d75da772 /challenge-077/abigail/test.pl
parentec09b571a6f2186fec8870a071a8d5d38596c850 (diff)
parent5ac16ac7e9826137e0da5597e954f4992c66205d (diff)
downloadperlweeklychallenge-club-bca0c362c212fc0dadc5ed7d9a5e4fa1aece4bfb.tar.gz
perlweeklychallenge-club-bca0c362c212fc0dadc5ed7d9a5e4fa1aece4bfb.tar.bz2
perlweeklychallenge-club-bca0c362c212fc0dadc5ed7d9a5e4fa1aece4bfb.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'challenge-077/abigail/test.pl')
-rwxr-xr-xchallenge-077/abigail/test.pl44
1 files changed, 44 insertions, 0 deletions
diff --git a/challenge-077/abigail/test.pl b/challenge-077/abigail/test.pl
new file mode 100755
index 0000000000..115e570c62
--- /dev/null
+++ b/challenge-077/abigail/test.pl
@@ -0,0 +1,44 @@
+#!/opt/perl/bin/perl
+
+#
+# Test the solutions. Either call it with the directory name you
+# want to test in, or call it as "../test.pl" from within the directory.
+#
+
+use 5.032;
+
+use strict;
+use warnings;
+no warnings 'syntax';
+
+chdir shift if @ARGV;
+
+use experimental 'signatures';
+
+use Test::More;
+
+my %languages = (
+ Perl => ["/opt/perl/bin/perl" => 'pl'],
+ JavaScript => ["/usr/local/bin/node" => 'js'],
+);
+
+
+my @inputs = <input*>;
+
+foreach my $language (sort keys %languages) {
+ my ($exe, $ext) = @{$languages {$language}};
+ next unless -r "solution.$ext";
+ subtest $language => sub {
+ foreach my $input (@inputs) {
+ my $output_exp = ($input =~ s/input/output/r) . ".exp";
+ my $exp = `cat $output_exp`;
+ my $got = `$exe ./solution.$ext < $input`;
+ is $got, $exp, $input;
+ }
+ }
+}
+
+done_testing;
+
+
+__END__