t_is
- t_is(got, expected, prec, msg)
t_is()- Tests if two matrices are identical to some tolerance.t_is(got, expected, prec, msg) ok = t_is(got, expected, prec, msg)
Test passes if the maximum difference between corresponding elements of
gotandexpectedis less than \(10^{-prec}\).- Inputs:
got (double) – numerical matrix of actual test results
expected (double) – numerical matrix of expected test results
prec (double) – defines the match tolerance, \(10^{-prec}\)
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 test passes, then it increments the passed tests count, otherwise increments the failed tests count. Prints “ok” or “not ok” followed by the
msg, unlesst_begin()was called with inputquietequal true.The input values can be real or complex, and they can be scalar, vector, or 2-d or higher matrices. If
gotis a vector or matrix andexpectedis a scalar or NaN, all elements must match the scalar. NaN values are considered to be equal to each other, as are Inf values.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_ok(),t_file_match(),t_str_match(),t_skip(),t_begin(),t_end(),t_run_tests().