Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Test-a-function/Wren/test-a-function.wren
Normal file
20
Task/Test-a-function/Wren/test-a-function.wren
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import "/module" for Expect, Suite, ConsoleReporter
|
||||
|
||||
var isPal = Fn.new { |word| word == ((word.count > 0) ? word[-1..0] : "") }
|
||||
|
||||
var words = ["rotor", "rosetta", "step on no pets", "été", "wren", "🦊😀🦊"]
|
||||
var expected = [true, false, true, true, false, true]
|
||||
|
||||
var TestPal = Suite.new("Pal") { |it|
|
||||
it.suite("'isPal' function:") { |it|
|
||||
for (i in 0...words.count) {
|
||||
it.should("return '%(expected[i])' for '%(words[i])' is palindrome") {
|
||||
Expect.call(isPal.call(words[i])).toEqual(expected[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var reporter = ConsoleReporter.new()
|
||||
TestPal.run(reporter)
|
||||
reporter.epilogue()
|
||||
Loading…
Add table
Add a link
Reference in a new issue