How to resolve the algorithm Test a function step by step in the zkl programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Test a function step by step in the zkl programming language
Table of Contents
Problem Statement
Using a well-known testing-specific library/module/suite for your language, write some tests for your language's entry in Palindrome. If your language does not have a testing specific library well known to the language's community then state this or omit the language.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Test a function step by step in the zkl programming language
Source code in the zkl programming language
fcn pali(text){
if (text.len()<2) return(False);
text==text.reverse();
}
tester:=TheVault.Test.UnitTester.UnitTester(__FILE__);
// spaces make this not a palindrome
tester.testRun(pali.fp("red rum sir is murder"), Void,False,__LINE__);
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);
zkl paliTest.zkl
zkl Test.testThemAll -- paliTest.zkl
You may also check:How to resolve the algorithm Operator precedence step by step in the PicoLisp programming language
You may also check:How to resolve the algorithm Terminal control/Display an extended character step by step in the Clojure programming language
You may also check:How to resolve the algorithm Draw a clock step by step in the Quackery programming language
You may also check:How to resolve the algorithm Stem-and-leaf plot step by step in the Python programming language
You may also check:How to resolve the algorithm Subleq step by step in the EasyLang programming language