help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: automated testing


From: Jaroslav Hajek
Subject: Re: automated testing
Date: Wed, 30 Jul 2008 13:31:50 +0200

On Wed, Jul 30, 2008 at 1:18 PM, Bart Vandewoestyne
<address@hidden> wrote:
> Dear list,
>
> I am currently converting a Fortran 95 package to Octave/Matlab.
> I would like to add some kind of automated testing to my
> Octave code without giving up Matlab compatibility.
>
> I found out that there exists an 'assert' and 'test' command in
> Octave.  The use of the assert command is quite straightforward, but I am
> a bit confused about how to use the 'test' command.  The
> documentation in my version of Octave only mentions:
>

try "doc test" or read here:
http://www.gnu.org/software/octave/doc/interpreter/Test-Functions.html#Test-Functions


> "Perform tests from the first file in the loadpath matching NAME."
>
> It does not explain how the tests in the to-be-tested file should be setup.
>
> I looked at the code of factorial.m and at the end I find stuff
> like
>
> %!assert (factorial(5), prod(1:5))
> %!assert (factorial([1,2;3,4]), [1,2;6,24])
> %!assert (factorial(70), exp(sum(log(1:70))), -128*eps)
> %!fail ('factorial(5.5)', "must all be nonnegative integers")
> %!fail ('factorial(-3)', "must all be nonnegative integers")
>
> Is this the proper way to setup automated testing for .m files?  Namely by
> using assert and fail commands at the end of an .m file?  Are there other
> things that are interesting to know when it comes to automated testing for
> .m files?
>
> I tried to find documentation on this subject using Google, but i didn't 
> really
> find something useful.
> If somebody can point me in the right direction by
> giving me a link where the testing-mechanism is explained, that would be nice.
>
> Kind regards,
> Bart
>
> --
>        "Share what you know.  Learn what you don't."
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]