September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
15
Task/Test-a-function/Kotlin/test-a-function.kotlin
Normal file
15
Task/Test-a-function/Kotlin/test-a-function.kotlin
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// version 1.1.3
|
||||
|
||||
fun isPalindrome(s: String) = (s == s.reversed())
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val testCases = listOf("racecar", "alice", "eertree", "david")
|
||||
for (testCase in testCases) {
|
||||
try {
|
||||
assert(isPalindrome(testCase)) { "$testCase is not a palindrome" }
|
||||
}
|
||||
catch (ae: AssertionError) {
|
||||
println(ae.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
6
Task/Test-a-function/Scheme/test-a-function.ss
Normal file
6
Task/Test-a-function/Scheme/test-a-function.ss
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
(import (srfi 64))
|
||||
(test-begin "palindrome-tests")
|
||||
(test-assert (palindrome? "ingirumimusnocteetconsumimurigni"))
|
||||
(test-assert (not (palindrome? "This is not a palindrome")))
|
||||
(test-equal #t (palindrome? "ingirumimusnocteetconsumimurigni")) ; another of several test functions
|
||||
(test-end)
|
||||
4
Task/Test-a-function/Zkl/test-a-function-1.zkl
Normal file
4
Task/Test-a-function/Zkl/test-a-function-1.zkl
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
fcn pali(text){
|
||||
if (text.len()<2) return(False);
|
||||
text==text.reverse();
|
||||
}
|
||||
3
Task/Test-a-function/Zkl/test-a-function-2.zkl
Normal file
3
Task/Test-a-function/Zkl/test-a-function-2.zkl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
tester:=TheVault.Test.UnitTester.UnitTester(__FILE__);
|
||||
// spaces make this not a palindrome
|
||||
tester.testRun(pali.fp("red rum sir is murder"), Void,False,__LINE__);
|
||||
11
Task/Test-a-function/Zkl/test-a-function-3.zkl
Normal file
11
Task/Test-a-function/Zkl/test-a-function-3.zkl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
tester:=TheVault.Test.UnitTester.UnitTester(__FILE__);
|
||||
fcn pali(text){
|
||||
if (text.len()<2) return(False);
|
||||
text==text.reverse();
|
||||
}
|
||||
tester.testRun(pali.fp("red rum sir is murder" - " "), Void,True,__LINE__);
|
||||
tester.testRun(pali.fp("red rum sir is murder"), Void,True,__LINE__); //bad test
|
||||
tester.testSrc("var R=(1+2)",Void,Void,3,__LINE__); // you can test source too
|
||||
|
||||
tester.stats();
|
||||
returnClass(tester);
|
||||
1
Task/Test-a-function/Zkl/test-a-function-4.zkl
Normal file
1
Task/Test-a-function/Zkl/test-a-function-4.zkl
Normal file
|
|
@ -0,0 +1 @@
|
|||
zkl paliTest.zkl
|
||||
1
Task/Test-a-function/Zkl/test-a-function-5.zkl
Normal file
1
Task/Test-a-function/Zkl/test-a-function-5.zkl
Normal file
|
|
@ -0,0 +1 @@
|
|||
zkl Test.testThemAll -- paliTest.zkl
|
||||
Loading…
Add table
Add a link
Reference in a new issue