Questions about testing
David Bateman
dbateman at dbateman.org
Mon Jun 15 14:23:30 CDT 2009
Robert T. Short wrote:
> Bob has some questions. This is regarding the tests in the tests
> directory. Mostly I think it is pretty straightforward, but just to
> make sure I understand.
>
> Most but not all of the files in the test directory have a series of
> entries of the form
>
> %% test/octave.test/transpose/transpose-1.m
> %!test
> %! scalar = 2;
> %! assert(scalar',2);
>
> Question 1.
>
> What does the first line
>
> %% test/octave.test/transpose/transpose-1.m
The octave test system used to be under DejaGnu, but that instantiated a
new instance of Octave for every test. The advantage of that is that
even tests that core-dumped octave would stop the other tests running.
But the penalty in time is too high when we have a few thousand tests.
Most of the scripts in this directory were converted to the new test
scheme a few years ago with a lot of nasty scripts and for historical
reasons I kept the old DejaGnu filename as a comment.. A few years down
the track with DejaGnu buried these lines no longer make sense and
should probably go.
> do? I don't find a file anywhere called transpose-1.m
>
> Question 2.
>
> Does the %! have some special significance, or does it just indicate
> that the embedded code is to be executed as part of the test?
Yes the "%!" anywhere is a file of any sort as the first two characters
on a line will cause the Octave test harness to treat the following
lines as a test function.. A lot of the m-files and C++ files are
sprinkled with such lines.
>
> Question 3.
>
> What does the
>
> %!test
>
> line do?
See the manual
http://www.gnu.org/software/octave/doc/interpreter/Test-and-Demo-Functions.html
D.
>
> Bob
> --
> Robert T. Short
> PhaseLocked Systems
>
>
>
--
David Bateman dbateman at dbateman.org
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
More information about the Octave-maintainers
mailing list