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)!
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