Jump to content

Test a function: Difference between revisions

(Added UNIX Shell solution)
Line 76:
end;
end Test_Function;</lang>
 
Ada 2012 introduced a new way to specify functions and test their correctness: Pre- and Postoconditions.
 
<lang Ada> function Palindrome (Text : String) return Boolean
with Post => Palindrome'Result =
(Text'Length < 2 or else
((Text(Text'First) = Text(Text'Last)) and then
Palindrome(Text(Text'First+1 .. Text'Last-1))));</lang>
 
=={{header|AutoHotkey}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.