t_ok
- t_ok(cond, msg)
t_ok()- Tests whether a condition is true.t_ok(expr, msg) ok = t_ok(expr, msg)
Test passes if
exprevaluates to true.- Inputs:
expr (logical) – logical expression from actual test results
msg (char array) – message to display for this test
- Output:
ok (logical) – (optional) true if test passed, false if failed
Increments the global test count and if the
expris true it increments the passed tests count, otherwise increments the failed tests count. Prints “ok” or “not ok” followed by themsg, unlesst_begin()was called with inputquietequal true.Intended to be called between calls to
t_begin()andt_end().Example:
quiet = 0; t_begin(5, quiet); t_ok(pi > 3, 'size of pi'); t_skip(3, 'not yet written'); t_is(2+2, 4, 12, '2+2 still equals 4'); t_end;
See also
t_is(),t_file_match(),t_str_match(),t_skip(),t_begin(),t_end(),t_run_tests().