September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View 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)
}
}
}

View 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)

View file

@ -0,0 +1,4 @@
fcn pali(text){
if (text.len()<2) return(False);
text==text.reverse();
}

View 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__);

View 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);

View file

@ -0,0 +1 @@
zkl paliTest.zkl

View file

@ -0,0 +1 @@
zkl Test.testThemAll -- paliTest.zkl