

Task

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.



with javascript_semantics
requires("0.8.2")
 
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)          -- first and last two lines only
set_test_verbosity(TEST_SHOW_ALL)               -- as shown in last two cases below
 
--set_test_abort(TEST_ABORT)                    -- abort(1) on failure, after showing the summary
--set_test_abort(TEST_QUIET)                    -- quietly carry on, the default
--set_test_abort(TEST_CRASH)                    -- abort immmediately on failure (w/o summary)

--set_test_pause(TEST_PAUSE_FAIL)               -- pause on failure, the default
--set_test_pause(TEST_QUIET)                    -- disable pause on failure
--set_test_pause(TEST_PAUSE)                    -- always pause

set_test_module("palindromes")                  -- optional, w/o first line is omitted
 
test_true(is_palindrome("abba"),"abba")
test_true(is_palindrome("abba"))                -- no desc makes success hidden...
                                                -- ...and failure somewhat laconic
test_false(is_palindrome("abc"),"not abc")
test_true(is_palindrome("failure"),"failure")
 
test_summary()
