[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
function definitions in tests
From: |
Thorsten Meyer |
Subject: |
function definitions in tests |
Date: |
Sat, 16 Jan 2010 18:34:12 +0100 |
User-agent: |
Mozilla-Thunderbird 2.0.0.22 (X11/20090706) |
Hi,
the tests for for example fsolve.m contain function definitions like this:
%!function retval = f (p)
%! x = p(1);
%! y = p(2);
%! z = p(3);
%! retval = zeros (3, 1);
%! retval(1) = sin(x) + y**2 + log(z) - 7;
%! retval(2) = 3*x + 2**y -z**3 + 1;
%! retval(3) = x + y + z - 5;
%!test
%! x_opt = [ 0.599054;
%! 2.395931;
%! 2.005014 ];
%! tol = 1.0e-5;
%! [x, fval, info] = fsolve (@f, [ 0.5; 2.0; 2.5 ]);
%! assert (info > 0);
%! assert (norm (x - x_opt, Inf) < tol);
%! assert (norm (fval) < tol);
And these tests are passed nicely when running "make check".
However, when I try to test fsolve from an interactive octave session I get:
octave:1> test fsolve
***** function retval = f (p)
x = p(1);
y = p(2);
z = p(3);
retval = zeros (3, 1);
retval(1) = sin(x) + y**2 + log(z) - 7;
retval(2) = 3*x + 2**y -z**3 + 1;
retval(3) = x + y + z - 5;
!!!!! test failed: syntax error
parse error:
function body open at end of input
Probably, I am missing something obvious. How can I run tests with function
definitions interactively?
Thorsten
- function definitions in tests,
Thorsten Meyer <=
- Re: function definitions in tests, David Grundberg, 2010/01/18
- Re: function definitions in tests, John W. Eaton, 2010/01/18
- Re: function definitions in tests, Thorsten Meyer, 2010/01/18
- Re: function definitions in tests, John W. Eaton, 2010/01/18
- Re: function definitions in tests, Jaroslav Hajek, 2010/01/19
- Re: function definitions in tests, John W. Eaton, 2010/01/19
- Re: function definitions in tests, Jaroslav Hajek, 2010/01/19
- Re: function definitions in tests, David Grundberg, 2010/01/19
- Re: function definitions in tests, John W. Eaton, 2010/01/19
- Re: function definitions in tests, David Grundberg, 2010/01/19