Test a function: Difference between revisions

Line 1,458:
Files=1, Tests=24, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.05 CPU)
Result: FAIL</pre>
 
=={{header|Phix}}==
Requires 0.8.2+, which implements the following routines (and a few others) in builtins/unit_tests.e (an autoinclude)
<lang Phix>function is_palindrome(sequence s)
return s==reverse(s)
end function
--set_test_verbosity(TEST_QUIET) -- (default, no output when third call removed)
--set_test_verbosity(TEST_SUMMARY) -- (first and last line only [w or w/o ""])
--set_test_verbosity(TEST_SHOW_FAILED_ONLY) -- (first and last two lines only)
set_test_verbosity(TEST_SHOW_ALL) -- (as shown below)
 
--set_wait_on_summary(-1) -- (pause on failure [default])
--set_wait_on_summary(0) -- (disable pause on failure)
--set_wait_on_summary(1) -- (always pause)
 
set_test_module("palindromes") -- (optional, w/o first line is omitted)
 
test_true(is_palindrome("abba"),"is_palindrome(abba)")
test_true(is_palindrome("abba")) -- (no desc makes success hidden)
test_false(is_palindrome("abc"),"not is_palindrome(abc)")
test_true(is_palindrome("failure"),"is_palindrome(failure)")
 
test_summary()</lang>
{{out}}
<pre>
palindromes:
passed: is_palindrome(abba)
passed: not is_palindrome(abc)
failed: is_palindrome(failure)
 
4 tests run, 3 passed, 1 failed, 75% success
Press Any Key to continue...
</pre>
 
=={{header|PicoLisp}}==
7,794

edits