From ad0e124c218efceb044dc3e9d7c7d03faa2be553 Mon Sep 17 00:00:00 2001 From: Paulo Custodio Date: Fri, 19 Feb 2021 20:02:07 +0000 Subject: Use new test script driven by yaml files --- challenge-096/paulo-custodio/t/test-1.yaml | 10 +++++ challenge-096/paulo-custodio/t/test-2.yaml | 17 ++++++++ challenge-096/paulo-custodio/test.pl | 66 +----------------------------- 3 files changed, 28 insertions(+), 65 deletions(-) create mode 100644 challenge-096/paulo-custodio/t/test-1.yaml create mode 100644 challenge-096/paulo-custodio/t/test-2.yaml 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" => < <