Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/Test-a-function/PureBasic/test-a-function.basic
Normal file
27
Task/Test-a-function/PureBasic/test-a-function.basic
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
Macro DoubleQuote
|
||||
; Needed for the Assert-Macro below
|
||||
" ; " second dlbquote to prevent Rosettas misshighlighting of following code. Remove comment before execution!
|
||||
EndMacro
|
||||
Macro Assert(TEST,MSG="")
|
||||
CompilerIf #PB_Compiler_Debugger
|
||||
If Not (TEST)
|
||||
If MSG<>"": Debug MSG: EndIf
|
||||
Temp$="Fail: "+DoubleQuote#TEST#DoubleQuote
|
||||
Debug Temp$+", Line="+Str(#PB_Compiler_Line)+" in "+#PB_Compiler_File
|
||||
CallDebugger
|
||||
EndIf
|
||||
CompilerEndIf
|
||||
EndMacro
|
||||
|
||||
Procedure IsPalindrome(StringToTest.s)
|
||||
If StringToTest=ReverseString(StringToTest)
|
||||
ProcedureReturn 1
|
||||
Else
|
||||
ProcedureReturn 0
|
||||
EndIf
|
||||
EndProcedure
|
||||
|
||||
text1$="racecar"
|
||||
text2$="wisconsin"
|
||||
Assert(IsPalindrome(text1$), "Catching this would be a fail")
|
||||
Assert(IsPalindrome(text2$), "Catching this is correct")
|
||||
Loading…
Add table
Add a link
Reference in a new issue