help-octave
[Top][All Lists]
Advanced

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

Re: TDD in Octave, guidance/tutorial?


From: IainIsm
Subject: Re: TDD in Octave, guidance/tutorial?
Date: Tue, 5 Feb 2013 04:01:26 -0800 (PST)

On 4 February 2013 18:08, Jordi Gutiérrez Hermoso-2 [via Octave] <[hidden email]> wrote:
On 4 February 2013 12:29, IainIsm <[hidden email]> wrote:
> For example I have started to write a function which requires two parameters
> and then can accept optional parameters, provided as a pair:
>
> getAccelData(required1, required2)
> getAccelData(required1, required2, optional1, optional2)
[snip]
> !!!!! test failed
> No matching property found for: test

How are you writing getAccelData? Are you using inputParser?

- Jordi G. H.
_______________________________________________
Help-octave mailing list
[hidden email]
https://mailman.cae.wisc.edu/listinfo/help-octave

Hi - I am (was?) using a homebrew approach, but now I've looked up inputParser I might just use that instead (thank you)!

In the meantime, from the documentation at http://www.gnu.org/software/octave/doc/interpreter/Test-Functions.html I was expecting that the following MWE would test successfully:

function output = mustBeZero(input)
if (input ~= 0)
  error('Non-zero input!')
end
output=input;

%!test fail(mustBeZero(1));
%!test assert(mustBeZero(0), 0);

But what I get is:

octave:29> test mustBeZero verbose
>>>>> L:\octave\testing\mustBeZero.m
  ***** test fail(mustBeZero(1));
!!!!! test failed
Non-zero input!

But this doesn't match what I understood from the documentation since an 'expected failure' is occurring?

After a lot of playing the only way I can get the 'expected failure' test to pass is to use xtest:

%!xtest fail(mustBeZero(1));

And I then get:
octave:30> test mustBeZero verbose
>>>>> L:\octave\testing\mustBeZero.m
  ***** xtest fail(mustBeZero(1));
!!!!! known failure
Non-zero input!
  ***** test assert(mustBeZero(0), 0);
PASSES 2 out of 2 tests (1 expected failures)

(Perhaps what I've found is a problem with the clarity of the documentation?)

Iain



View this message in context: Re: TDD in Octave, guidance/tutorial?
Sent from the Octave - General mailing list archive at Nabble.com.

reply via email to

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