aboutsummaryrefslogtreecommitdiff
path: root/challenge-096
diff options
context:
space:
mode:
authorPaulo Custodio <pauloscustodio@gmail.com>2021-02-19 20:02:07 +0000
committerPaulo Custodio <pauloscustodio@gmail.com>2021-02-19 20:02:07 +0000
commitad0e124c218efceb044dc3e9d7c7d03faa2be553 (patch)
tree5818e5181896c20847d18b081e36b309695af95d /challenge-096
parentac4d89f845c6454f12fe5bd9e701937ac0951d00 (diff)
downloadperlweeklychallenge-club-ad0e124c218efceb044dc3e9d7c7d03faa2be553.tar.gz
perlweeklychallenge-club-ad0e124c218efceb044dc3e9d7c7d03faa2be553.tar.bz2
perlweeklychallenge-club-ad0e124c218efceb044dc3e9d7c7d03faa2be553.zip
Use new test script driven by yaml files
Diffstat (limited to 'challenge-096')
-rw-r--r--challenge-096/paulo-custodio/t/test-1.yaml10
-rw-r--r--challenge-096/paulo-custodio/t/test-2.yaml17
-rw-r--r--challenge-096/paulo-custodio/test.pl66
3 files changed, 28 insertions, 65 deletions
diff --git a/challenge-096/paulo-custodio/t/test-1.yaml b/challenge-096/paulo-custodio/t/test-1.yaml
new file mode 100644
index 0000000000..de8e55d531
--- /dev/null
+++ b/challenge-096/paulo-custodio/t/test-1.yaml
@@ -0,0 +1,10 @@
+- setup:
+ cleanup:
+ args: The Weekly Challenge
+ input:
+ output: Challenge Weekly The
+- setup:
+ cleanup:
+ args: ' Perl and Raku are part of the same family '
+ input:
+ output: family same the of part are Raku and Perl
diff --git a/challenge-096/paulo-custodio/t/test-2.yaml b/challenge-096/paulo-custodio/t/test-2.yaml
new file mode 100644
index 0000000000..52de7d442e
--- /dev/null
+++ b/challenge-096/paulo-custodio/t/test-2.yaml
@@ -0,0 +1,17 @@
+- setup:
+ cleanup:
+ args: kitten sitting
+ input:
+ output: |
+ |3
+ |Operation 1: replace 'k' with 's'
+ |Operation 2: replace 'e' with 'i'
+ |Operation 3: insert 'g' at end
+- setup:
+ cleanup:
+ args: sunday monday
+ input:
+ output: |
+ |2
+ |Operation 1: replace 's' with 'm'
+ |Operation 2: replace 'u' with 'o'
diff --git a/challenge-096/paulo-custodio/test.pl b/challenge-096/paulo-custodio/test.pl
index 29b27ddfda..01ed2b83cd 100644
--- a/challenge-096/paulo-custodio/test.pl
+++ b/challenge-096/paulo-custodio/test.pl
@@ -3,69 +3,5 @@
use strict;
use warnings;
use 5.030;
-use Test::More;
-# hack so that output redirection works in msys
-my $LUA = $^O eq "msys" ? "lua.exe" : "lua";
-
-run("gcc c/ch-1.c -o c/ch-1");
-run("g++ cpp/ch-1.cpp -o cpp/ch-1");
-run("fbc basic/ch-1.bas -o basic/ch-1");
-
-for (["The Weekly Challenge" => "Challenge Weekly The"],
- ["' Perl and Raku are part of the same family '" =>
- "family same the of part are Raku and Perl"]) {
- my($in, $out) = @$_;
-
- is capture( "perl perl/ch-1.pl $in"), "$out\n";
- is capture( "$LUA lua/ch-1.lua $in"), "$out\n";
- is capture("python python/ch-1.py $in"), "$out\n";
- is capture( "gforth forth/ch-1.fs $in"), "$out\n";
- is capture( "c/ch-1 $in"), "$out\n";
- is capture( "cpp/ch-1 $in"), "$out\n";
- is capture( "basic/ch-1 $in"), "$out\n";
-}
-
-
-is capture("perl perl/ch-2a.pl kitten sitting"), "3\n";
-is capture("perl perl/ch-2a.pl sunday monday"), "2\n";
-
-run("gcc c/ch-2.c -o c/ch-2");
-run("g++ cpp/ch-2.cpp -o cpp/ch-2");
-run("fbc basic/ch-2.bas -o basic/ch-2");
-
-for (["kitten sitting" => <<END],
-3
-Operation 1: replace 'k' with 's'
-Operation 2: replace 'e' with 'i'
-Operation 3: insert 'g' at end
-END
- ["sunday monday" => <<END]) {
-2
-Operation 1: replace 's' with 'm'
-Operation 2: replace 'u' with 'o'
-END
- my($in, $out) = @$_;
-
- is capture( "perl perl/ch-2.pl $in"), $out;
- is capture( "$LUA lua/ch-2.lua $in"), $out;
- is capture( "gforth forth/ch-2.fs $in"), $out;
- is capture("python python/ch-2.py $in"), $out;
- is capture( "c/ch-2 $in"), $out;
- is capture( "cpp/ch-2 $in"), $out;
- is capture( "basic/ch-2 $in"), $out;
-}
-
-done_testing;
-
-sub capture {
- my($cmd) = @_;
- my $out = `$cmd`;
- $out =~ s/[ \r\t]*\n/\n/g;
- return $out;
-}
-
-sub run {
- my($cmd) = @_;
- ok 0==system($cmd), $cmd;
-}
+require '../../challenge-001/paulo-custodio/test.pl';