Test a function: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: better descs)
Line 1,476: Line 1,476:
set_test_module("palindromes") -- (optional, w/o first line is omitted)
set_test_module("palindromes") -- (optional, w/o first line is omitted)


test_true(is_palindrome("abba"),"is_palindrome(abba)")
test_true(is_palindrome("abba"),"abba")
test_true(is_palindrome("abba")) -- (no desc makes success hidden...)
test_true(is_palindrome("abba")) -- (no desc makes success hidden...)
-- (...and failure somewhat laconic)
-- (...and failure somewhat laconic)
test_false(is_palindrome("abc"),"not is_palindrome(abc)")
test_false(is_palindrome("abc"),"not abc")
test_true(is_palindrome("failure"),"is_palindrome(failure)")
test_true(is_palindrome("failure"),"failure")


test_summary()</lang>
test_summary()</lang>
Line 1,487: Line 1,487:
<pre>
<pre>
palindromes:
palindromes:
passed: is_palindrome(abba)
passed: abba
passed: not is_palindrome(abc)
passed: not abc
failed: is_palindrome(failure)
failed: failure


4 tests run, 3 passed, 1 failed, 75% success
4 tests run, 3 passed, 1 failed, 75% success