diff options
| author | Roger Bell_West <roger@firedrake.org> | 2024-07-23 12:14:45 +0100 |
|---|---|---|
| committer | Roger Bell_West <roger@firedrake.org> | 2024-07-23 12:14:45 +0100 |
| commit | 80c25872bafd4102a3e55414be3e8886c6f01c32 (patch) | |
| tree | 228d2784ba3ecc8cfb29f892855d278b7c9cbf24 /challenge-279 | |
| parent | df06dc4dd8e2f389815e3011cc935dc19c54a5d6 (diff) | |
| download | perlweeklychallenge-club-80c25872bafd4102a3e55414be3e8886c6f01c32.tar.gz perlweeklychallenge-club-80c25872bafd4102a3e55414be3e8886c6f01c32.tar.bz2 perlweeklychallenge-club-80c25872bafd4102a3e55414be3e8886c6f01c32.zip | |
RogerBW solutions for challenge no. 279
Diffstat (limited to 'challenge-279')
23 files changed, 791 insertions, 0 deletions
diff --git a/challenge-279/roger-bell-west/crystal/ch-1.cr b/challenge-279/roger-bell-west/crystal/ch-1.cr new file mode 100755 index 0000000000..6b9ee7a5d1 --- /dev/null +++ b/challenge-279/roger-bell-west/crystal/ch-1.cr @@ -0,0 +1,21 @@ +#! /usr/bin/crystal +require "spec" +describe "sortletters" do + it "test_ex1" do + sortletters(['R', 'E', 'P', 'L'], [3, 2, 1, 4]).should eq "PERL" + end + it "test_ex2" do + sortletters(['A', 'U', 'R', 'K'], [2, 4, 1, 3]).should eq "RAKU" + end + it "test_ex3" do + sortletters(['O', 'H', 'Y', 'N', 'P', 'T'], [5, 4, 2, 6, 1, 3]).should eq "PYTHON" + end +end + +def sortletters(a, n) + out = a.clone + a.each_with_index do |l, i| + out[n[i] - 1] = l + end + out.join("") +end diff --git a/challenge-279/roger-bell-west/crystal/ch-2.cr b/challenge-279/roger-bell-west/crystal/ch-2.cr new file mode 100755 index 0000000000..7583c95641 --- /dev/null +++ b/challenge-279/roger-bell-west/crystal/ch-2.cr @@ -0,0 +1,26 @@ +#! /usr/bin/crystal +require "spec" +describe "splitstring" do + it "test_ex1" do + splitstring("perl").should eq false + end + it "test_ex2" do + splitstring("book").should eq true + end + it "test_ex3" do + splitstring("goodmorning").should eq true + end +end + +def splitstring(a) + n = 0 + a.downcase.chars.each do |cc| + n += case cc + when 'a', 'e', 'i', 'o', 'u' + 1 + else + 0 + end + end + n % 2 == 0 +end diff --git a/challenge-279/roger-bell-west/javascript/ch-1.js b/challenge-279/roger-bell-west/javascript/ch-1.js new file mode 100755 index 0000000000..bac790774a --- /dev/null +++ b/challenge-279/roger-bell-west/javascript/ch-1.js @@ -0,0 +1,30 @@ +#! /usr/bin/node + +"use strict" + +function sortletters(a, c) { + let out = Array(a.length); + a.forEach((l, i) => { + out[c[i] - 1] = l; + }); + return out.join(""); +} + +if (sortletters(['R', 'E', 'P', 'L'], [3, 2, 1, 4]) == 'PERL') { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write(" "); +if (sortletters(['A', 'U', 'R', 'K'], [2, 4, 1, 3]) == 'RAKU') { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write(" "); +if (sortletters(['O', 'H', 'Y', 'N', 'P', 'T'], [5, 4, 2, 6, 1, 3]) == 'PYTHON') { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write("\n"); diff --git a/challenge-279/roger-bell-west/javascript/ch-2.js b/challenge-279/roger-bell-west/javascript/ch-2.js new file mode 100755 index 0000000000..0a8393a0bb --- /dev/null +++ b/challenge-279/roger-bell-west/javascript/ch-2.js @@ -0,0 +1,37 @@ +#! /usr/bin/node + +"use strict" + +function splitstring(a) { + let n = 0 + for (let cc of a.toLowerCase().split("")) { + switch (cc.toLowerCase()) { + case "a": + case "e": + case "i": + case "o": + case "u": + n++; + } + } + return n % 2 == 0 +} + +if (!splitstring('perl')) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write(" "); +if (splitstring('book')) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write(" "); +if (splitstring('goodmorning')) { + process.stdout.write("Pass"); +} else { + process.stdout.write("FAIL"); +} +process.stdout.write("\n"); diff --git a/challenge-279/roger-bell-west/kotlin/ch-1.kt b/challenge-279/roger-bell-west/kotlin/ch-1.kt new file mode 100644 index 0000000000..912874a8b0 --- /dev/null +++ b/challenge-279/roger-bell-west/kotlin/ch-1.kt @@ -0,0 +1,30 @@ +fun sortletters(a: List<Char>, c: List<Int>): String { + var out = ArrayList<Char>(a) + a.forEachIndexed{i, l -> + out[c[i] - 1] = l + } + return out.joinToString("") +} + +fun main() { + + if (sortletters(listOf('R', 'E', 'P', 'L'), listOf(3, 2, 1, 4)) == "PERL") { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (sortletters(listOf('A', 'U', 'R', 'K'), listOf(2, 4, 1, 3)) == "RAKU") { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (sortletters(listOf('O', 'H', 'Y', 'N', 'P', 'T'), listOf(5, 4, 2, 6, 1, 3)) == "PYTHON") { + print("Pass") + } else { + print("Fail") + } + println("") + +} diff --git a/challenge-279/roger-bell-west/kotlin/ch-2.kt b/challenge-279/roger-bell-west/kotlin/ch-2.kt new file mode 100644 index 0000000000..a61a196940 --- /dev/null +++ b/challenge-279/roger-bell-west/kotlin/ch-2.kt @@ -0,0 +1,33 @@ +fun splitstring(a: String): Boolean { + var n = 0 + for (cc in a.lowercase().toList()) { + n += when (cc) { + 'a', 'e', 'i', 'o', 'u' -> 1 + else -> 0 + } + } + return n % 2 == 0 +} + +fun main() { + + if (!splitstring("perl")) { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (splitstring("book")) { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (splitstring("goodmorning")) { + print("Pass") + } else { + print("Fail") + } + println("") + +} diff --git a/challenge-279/roger-bell-west/lua/ch-1.lua b/challenge-279/roger-bell-west/lua/ch-1.lua new file mode 100755 index 0000000000..a629772a39 --- /dev/null +++ b/challenge-279/roger-bell-west/lua/ch-1.lua @@ -0,0 +1,42 @@ +#! /usr/bin/lua + +function join(t) + local out="" + for i, v in ipairs(t) do + out = out .. v + end + return out +end + +function sortletters(a, n) + local out = {} + for _a, _b in ipairs(a) do + table.insert(out, "") + end + for i, l in ipairs(a) do + out[n[i]] = l + end + return join(out) +end + +if sortletters({"R", "E", "P", "L"}, {3, 2, 1, 4}) == "PERL" then + io.write("Pass") +else + io.write("FAIL") +end +io.write(" ") + +if sortletters({"A", "U", "R", "K"}, {2, 4, 1, 3}) == "RAKU" then + io.write("Pass") +else + io.write("FAIL") +end +io.write(" ") + +if sortletters({"O", "H", "Y", "N", "P", "T"}, {5, 4, 2, 6, 1, 3}) == "PYTHON" then + io.write("Pass") +else + io.write("FAIL") +end +print("") + diff --git a/challenge-279/roger-bell-west/lua/ch-2.lua b/challenge-279/roger-bell-west/lua/ch-2.lua new file mode 100755 index 0000000000..92edbe4bd6 --- /dev/null +++ b/challenge-279/roger-bell-west/lua/ch-2.lua @@ -0,0 +1,44 @@ +#! /usr/bin/lua + +function split(t) + local cl = {} + string.gsub(t, + "(.)", + function(c) + table.insert(cl, c) + end + ) + return cl +end + +function splitstring(a) + local n = 0 + for _, cc in ipairs(split(string.lower(a))) do + if string.find(cc, "[aeiou]") == 1 then + n = n + 1 + end + end + return n % 2 == 0 +end + +if not splitstring("perl") then + io.write("Pass") +else + io.write("FAIL") +end +io.write(" ") + +if splitstring("book") then + io.write("Pass") +else + io.write("FAIL") +end +io.write(" ") + +if splitstring("goodmorning") then + io.write("Pass") +else + io.write("FAIL") +end +print("") + diff --git a/challenge-279/roger-bell-west/perl/ch-1.pl b/challenge-279/roger-bell-west/perl/ch-1.pl new file mode 100755 index 0000000000..103430c4ea --- /dev/null +++ b/challenge-279/roger-bell-west/perl/ch-1.pl @@ -0,0 +1,19 @@ +#! /usr/bin/perl + +use strict; +use warnings; +use experimental 'signatures'; + +use Test::More tests => 3; + +is(sortletters(['R', 'E', 'P', 'L'], [3, 2, 1, 4]), 'PERL', 'example 1'); +is(sortletters(['A', 'U', 'R', 'K'], [2, 4, 1, 3]), 'RAKU', 'example 2'); +is(sortletters(['O', 'H', 'Y', 'N', 'P', 'T'], [5, 4, 2, 6, 1, 3]), 'PYTHON', 'example 3'); + +sub sortletters($a, $n) { + my @out = ("") x scalar @{$a}; + while (my ($i, $l) = each @{$a}) { + $out[$n->[$i] - 1] = $l; + } + return join('', @out); +} diff --git a/challenge-279/roger-bell-west/perl/ch-2.pl b/challenge-279/roger-bell-west/perl/ch-2.pl new file mode 100755 index 0000000000..a26973a6ed --- /dev/null +++ b/challenge-279/roger-bell-west/perl/ch-2.pl @@ -0,0 +1,21 @@ +#! /usr/bin/perl + +use strict; +use warnings; +use experimental 'signatures'; + +use Test::More tests => 3; + +is(splitstring('perl'), 0, 'example 1'); +is(splitstring('book'), 1, 'example 2'); +is(splitstring('goodmorning'), 1, 'example 3'); + +sub splitstring($a) { + my $n = 0; + foreach my $cc (split '', lc($a)) { + if ($cc =~ /[aeiou]/) { + $n++; + } + } + return ($n % 2 == 0)?1:0; +} diff --git a/challenge-279/roger-bell-west/postscript/ch-1.ps b/challenge-279/roger-bell-west/postscript/ch-1.ps new file mode 100644 index 0000000000..3aa659cd91 --- /dev/null +++ b/challenge-279/roger-bell-west/postscript/ch-1.ps @@ -0,0 +1,114 @@ +%!PS + +% begin included library code +% see https://codeberg.org/Firedrake/postscript-libraries/ +/s2a { + [ exch { } forall ] +} bind def + +/strconcat % (a) (b) -> (ab) +{ + [ + 3 -1 roll + s2a aload length + 2 add -1 roll + s2a aload pop + ] a2s +} bind def + +/test.end { + ( ) print + test.count 0 gt { + (Passed ) print + test.pass (...) cvs print + (/) print + test.count (...) cvs print + ( \() print + test.pass 100 mul test.count idiv (...) cvs print + (%\)) print + (\r\n) print + } if +} bind def + +/a2s { + 2 dict begin + /i exch def + i length dup string /o exch def + 1 sub 0 exch 1 exch { + dup i 3 -1 roll get o 3 1 roll put + } for + o + end +} bind def + +/test { + /test.count test.count 1 add def + { + /test.pass test.pass 1 add def + } { + ( ) print + test.count (....) cvs print + (-fail) print + } ifelse +} bind def + +/enumerate.array { + 1 dict begin + /a exch def + [ + 0 1 a length 1 sub { + [ exch dup a exch get ] + } for + ] + end +} bind def + +/test.start { + print (:) print + /test.pass 0 def + /test.count 0 def +} bind def + +/strjoin % [(a) (b) (c)] (j) -> (ajbjc) +{ + 3 dict begin + /j exch def + dup 0 get /out exch def + /first true def + { + first { + pop + /first false def + } { + out j strconcat + exch strconcat + /out exch def + } ifelse + } forall + out + end +} bind def + + +% end included library code + +/sortletters { + 0 dict begin + /c exch def + /a exch def + /out a length array def + a enumerate.array { + aload pop + /l exch def + /i exch def + out c i get 1 sub l put + } forall + out () strjoin + end +} bind def + +(sortletters) test.start +[(R) (E) (P) (L)] [3 2 1 4] sortletters (PERL) eq test +[(A) (U) (R) (K)] [2 4 1 3] sortletters (RAKU) eq test +[(O) (H) (Y) (N) (P) (T)] [5 4 2 6 1 3] sortletters (PYTHON) eq test +test.end diff --git a/challenge-279/roger-bell-west/postscript/ch-2.ps b/challenge-279/roger-bell-west/postscript/ch-2.ps new file mode 100644 index 0000000000..ef5892e451 --- /dev/null +++ b/challenge-279/roger-bell-west/postscript/ch-2.ps @@ -0,0 +1,67 @@ +%!PS + +% begin included library code +% see https://codeberg.org/Firedrake/postscript-libraries/ +/test { + /test.count test.count 1 add def + { + /test.pass test.pass 1 add def + } { + ( ) print + test.count (....) cvs print + (-fail) print + } ifelse +} bind def + +/test.end { + ( ) print + test.count 0 gt { + (Passed ) print + test.pass (...) cvs print + (/) print + test.count (...) cvs print + ( \() print + test.pass 100 mul test.count idiv (...) cvs print + (%\)) print + (\r\n) print + } if +} bind def + +/toset { % array -> dict of (value, true) + << exch + { + true + } forall + >> +} bind def + +/s2a { + [ exch { } forall ] +} bind def + +/test.start { + print (:) print + /test.pass 0 def + /test.count 0 def +} bind def + + +% end included library code + +/splitstring { + 0 dict begin + /vowels (aeiouAEIOU) s2a toset def + true exch + { + vowels exch known { + not + } if + } forall + end +} bind def + +(splitstring) test.start +(perl) splitstring not test +(book) splitstring test +(goodmorning) splitstring test +test.end diff --git a/challenge-279/roger-bell-west/python/ch-1.py b/challenge-279/roger-bell-west/python/ch-1.py new file mode 100755 index 0000000000..6e1eb74a7a --- /dev/null +++ b/challenge-279/roger-bell-west/python/ch-1.py @@ -0,0 +1,22 @@ +#! /usr/bin/python3 + +def sortletters(a, n): + out = a.copy() + for i, l in enumerate(a): + out[n[i] - 1] = l + return "".join(out) + +import unittest + +class TestSortletters(unittest.TestCase): + + def test_ex1(self): + self.assertEqual(sortletters(["R", "E", "P", "L"], [3, 2, 1, 4]), "PERL", 'example 1') + + def test_ex2(self): + self.assertEqual(sortletters(["A", "U", "R", "K"], [2, 4, 1, 3]), "RAKU", 'example 2') + + def test_ex3(self): + self.assertEqual(sortletters(["O", "H", "Y", "N", "P", "T"], [5, 4, 2, 6, 1, 3]), "PYTHON", 'example 3') + +unittest.main() diff --git a/challenge-279/roger-bell-west/python/ch-2.py b/challenge-279/roger-bell-west/python/ch-2.py new file mode 100755 index 0000000000..480e58ab2e --- /dev/null +++ b/challenge-279/roger-bell-west/python/ch-2.py @@ -0,0 +1,24 @@ +#! /usr/bin/python3 + +def splitstring(a): + n = 0 + for cc in a: + match cc.lower(): + case 'a' | 'e' | 'i' | 'o' | 'u': + n += 1 + return n % 2 == 0 + +import unittest + +class TestSplitstring(unittest.TestCase): + + def test_ex1(self): + self.assertEqual(splitstring("perl"), False, 'example 1') + + def test_ex2(self): + self.assertEqual(splitstring("book"), True, 'example 2') + + def test_ex3(self): + self.assertEqual(splitstring("goodmorning"), True, 'example 3') + +unittest.main() diff --git a/challenge-279/roger-bell-west/raku/ch-1.p6 b/challenge-279/roger-bell-west/raku/ch-1.p6 new file mode 100755 index 0000000000..ecc790d05a --- /dev/null +++ b/challenge-279/roger-bell-west/raku/ch-1.p6 @@ -0,0 +1,17 @@ +#! /usr/bin/raku + +use Test; + +plan 3; + +is(sortletters(['R', 'E', 'P', 'L'], [3, 2, 1, 4]), 'PERL', 'example 1'); +is(sortletters(['A', 'U', 'R', 'K'], [2, 4, 1, 3]), 'RAKU', 'example 2'); +is(sortletters(['O', 'H', 'Y', 'N', 'P', 'T'], [5, 4, 2, 6, 1, 3]), 'PYTHON', 'example 3'); + +sub sortletters(@a, @n) { + my @out = ["" x @a.elems]; + for @a.kv -> $i, $l { + @out[@n[$i] - 1] = $l; + } + return @out.join(''); +} diff --git a/challenge-279/roger-bell-west/raku/ch-2.p6 b/challenge-279/roger-bell-west/raku/ch-2.p6 new file mode 100755 index 0000000000..d27f3c126d --- /dev/null +++ b/challenge-279/roger-bell-west/raku/ch-2.p6 @@ -0,0 +1,19 @@ +#! /usr/bin/raku + +use Test; + +plan 3; + +is(splitstring('perl'), False, 'example 1'); +is(splitstring('book'), True, 'example 2'); +is(splitstring('goodmorning'), True, 'example 3'); + +sub splitstring($a) { + my $n = 0; + for $a.lc.comb -> $cc { + if ($cc ~~ /<[aeiou]>/) { + $n++; + } + } + return $n % 2 == 0; +} diff --git a/challenge-279/roger-bell-west/ruby/ch-1.rb b/challenge-279/roger-bell-west/ruby/ch-1.rb new file mode 100755 index 0000000000..7faf4d27f0 --- /dev/null +++ b/challenge-279/roger-bell-west/ruby/ch-1.rb @@ -0,0 +1,27 @@ +#! /usr/bin/ruby + +def sortletters(a, n) + out = a.clone + a.each_with_index do |l, i| + out[n[i] - 1] = l + end + out.join("") +end + +require 'test/unit' + +class TestSortletters < Test::Unit::TestCase + + def test_ex1 + assert_equal('PERL', sortletters(['R', 'E', 'P', 'L'], [3, 2, 1, 4])) + end + + def test_ex2 + assert_equal('RAKU', sortletters(['A', 'U', 'R', 'K'], [2, 4, 1, 3])) + end + + def test_ex3 + assert_equal('PYTHON', sortletters(['O', 'H', 'Y', 'N', 'P', 'T'], [5, 4, 2, 6, 1, 3])) + end + +end diff --git a/challenge-279/roger-bell-west/ruby/ch-2.rb b/challenge-279/roger-bell-west/ruby/ch-2.rb new file mode 100755 index 0000000000..a9c71a6f1e --- /dev/null +++ b/challenge-279/roger-bell-west/ruby/ch-2.rb @@ -0,0 +1,32 @@ +#! /usr/bin/ruby + +def splitstring(a) + n = 0 + a.downcase.chars.each do |cc| + n += case cc + when 'a', 'e', 'i', 'o', 'u' + 1 + else + 0 + end + end + n % 2 == 0 +end + +require 'test/unit' + +class TestSplitstring < Test::Unit::TestCase + + def test_ex1 + assert_equal(false, splitstring('perl')) + end + + def test_ex2 + assert_equal(true, splitstring('book')) + end + + def test_ex3 + assert_equal(true, splitstring('goodmorning')) + end + +end diff --git a/challenge-279/roger-bell-west/rust/ch-1.rs b/challenge-279/roger-bell-west/rust/ch-1.rs new file mode 100755 index 0000000000..692c711447 --- /dev/null +++ b/challenge-279/roger-bell-west/rust/ch-1.rs @@ -0,0 +1,28 @@ +#! /bin/sh +//usr/bin/env rustc --test $0 -o ${0}x && ./${0}x --nocapture; rm -f ${0}x ; exit + +#[test] +fn test_ex1() { + assert_eq!(sortletters(vec!['R', 'E', 'P', 'L'], vec![3, 2, 1, 4]), "PERL"); +} + +#[test] +fn test_ex2() { + assert_eq!(sortletters(vec!['A', 'U', 'R', 'K'], vec![2, 4, 1, 3]), "RAKU"); +} + +#[test] +fn test_ex3() { + assert_eq!( + sortletters(vec!['O', 'H', 'Y', 'N', 'P', 'T'], vec![5, 4, 2, 6, 1, 3]), + "PYTHON" + ); +} + +fn sortletters(a: Vec<char>, n: Vec<usize>) -> String { + let mut out: Vec<char> = vec![' '; a.len()]; + for (i, l) in a.iter().enumerate() { + out[n[i] - 1] = *l; + } + out.iter().collect::<String>() +} diff --git a/challenge-279/roger-bell-west/rust/ch-2.rs b/challenge-279/roger-bell-west/rust/ch-2.rs new file mode 100755 index 0000000000..6fd77fae0d --- /dev/null +++ b/challenge-279/roger-bell-west/rust/ch-2.rs @@ -0,0 +1,28 @@ +#! /bin/sh +//usr/bin/env rustc --test $0 -o ${0}x && ./${0}x --nocapture; rm -f ${0}x ; exit + +#[test] +fn test_ex1() { + assert_eq!(splitstring("perl"), false); +} + +#[test] +fn test_ex2() { + assert_eq!(splitstring("book"), true); +} + +#[test] +fn test_ex3() { + assert_eq!(splitstring("goodmorning"), true); +} + +fn splitstring(a: &str) -> bool { + let mut n = 0; + for cc in a.chars() { + n += match cc.to_ascii_lowercase() { + 'a' | 'e' | 'i' | 'o' | 'u' => 1, + _ => 0, + } + } + n % 2 == 0 +} diff --git a/challenge-279/roger-bell-west/scala/ch-1.scala b/challenge-279/roger-bell-west/scala/ch-1.scala new file mode 100644 index 0000000000..72c5330af8 --- /dev/null +++ b/challenge-279/roger-bell-west/scala/ch-1.scala @@ -0,0 +1,32 @@ +import scala.collection.mutable.ListBuffer + +object Sortletters { + def sortletters(a: List[Char], c: List[Int]): String = { + var out = ListBuffer.fill(a.length)('x') + for ((ch, i) <- a.zipWithIndex) { + out(c(i) - 1) = ch + } + out.mkString("") + } + def main(args: Array[String]) { + if (sortletters(List('R', 'E', 'P', 'L'), List(3, 2, 1, 4)) == "PERL") { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (sortletters(List('A', 'U', 'R', 'K'), List(2, 4, 1, 3)) == "RAKU") { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (sortletters(List('O', 'H', 'Y', 'N', 'P', 'T'), List(5, 4, 2, 6, 1, 3)) == "PYTHON") { + print("Pass") + } else { + print("Fail") + } + println("") + + } +} diff --git a/challenge-279/roger-bell-west/scala/ch-2.scala b/challenge-279/roger-bell-west/scala/ch-2.scala new file mode 100644 index 0000000000..1f6e88314f --- /dev/null +++ b/challenge-279/roger-bell-west/scala/ch-2.scala @@ -0,0 +1,34 @@ + +object Splitstring { + def splitstring(a: String): Boolean = { + var n = 0 + for (cc <- a.toList) { + cc.toLower match { + case 'a' | 'e' | 'i' | 'o' | 'u' => { n += 1 } + case _ => { } + } + } + n % 2 == 0 + } + def main(args: Array[String]) { + if (!splitstring("perl")) { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (splitstring("book")) { + print("Pass") + } else { + print("Fail") + } + print(" ") + if (splitstring("goodmorning")) { + print("Pass") + } else { + print("Fail") + } + println("") + + } +} diff --git a/challenge-279/roger-bell-west/tests.json b/challenge-279/roger-bell-west/tests.json new file mode 100644 index 0000000000..77b3593172 --- /dev/null +++ b/challenge-279/roger-bell-west/tests.json @@ -0,0 +1,44 @@ +{ + "ch-1" : [ + { + "function" : "sortletters", + "multiarg" : true, + "arguments" : [ + [ "R", "E", "P", "L" ], + [ 3, 2, 1, 4 ] + ], + "result" : "PERL" + }, + { + "multiarg" : true, + "arguments" : [ + [ "A", "U", "R", "K" ], + [ 2, 4, 1, 3 ] + ], + "result" : "RAKU" + }, + { + "multiarg" : true, + "arguments" : [ + [ "O", "H", "Y", "N", "P", "T" ], + [ 5, 4, 2, 6, 1, 3 ] + ], + "result" : "PYTHON" + } + ], + "ch-2" : [ + { + "function" : "splitstring", + "arguments" : "perl", + "result" : false + }, + { + "arguments" : "book", + "result" : true + }, + { + "arguments" : "goodmorning", + "result" : true + } + ] +} |
