1,855
edits
(→Error: added %!warning and checking for particular ids) |
m (Minor text revision and corrections, add category Category:Testing.) |
||
Line 18: | Line 18: | ||
{{codeline|mean()}}: | {{codeline|mean()}}: | ||
>> test mean | |||
PASSES 17 out of 17 tests | PASSES 17 out of 17 tests | ||
Line 27: | Line 27: | ||
installation. The whole Octave test suite can be ran with: | installation. The whole Octave test suite can be ran with: | ||
>> __run_test_suite__ | |||
Integrated test scripts: | Integrated test scripts: | ||
Line 108: | Line 108: | ||
=== Assert === | === Assert === | ||
{{codeline|%!assert}} lines are simplest tests to write and also the most | {{codeline|%!assert}} lines are the simplest tests to write and also the most | ||
common: | common: | ||
%!assert (foo (bar)) # test fails if "foo (bar)" returns false | %!assert (foo (bar)) # test fails if "foo (bar)" returns false | ||
%!assert (foo (bar), qux) # test fails if "foo (bar)" is different from "qux | %!assert (foo (bar), qux) # test fails if "foo (bar)" is different from "qux" | ||
These are actually a shorthand version of | These are actually a shorthand version of | ||
{{codeline|%!test assert (foo (bar))}}, and {{codeline|assert}} is simply | {{codeline|%!test assert (foo (bar))}}, and {{codeline|assert}} is simply | ||
an Octave function that throws | an Octave function that throws an error when two arguments fail to compare. | ||
=== Test === | === Test === | ||
While single | While single {{codeline|%!assert}} lines are the most common used tests, {{codeline|%!test}} blocks offer more features and flexibility. The code within {{codeline|%!test}} blocks is simply processed through the Octave interpreter. If the code generates an error, the test is said to fail. Often {{codeline|%!test}} blocks end with a call to {{codeline|assert}}: | ||
{{codeline|%!test}} blocks | |||
The code within | |||
%!test | %!test | ||
Line 177: | Line 173: | ||
[[Category:Testing]] | |||
[[Category:Development]] | [[Category:Development]] |