Add extended_powell functions and their tests.
[octave.git] / tests / extended_powell_gradient1_tests.m
1 ## The gradient should be zero at the optimal point.
2
3 for m = [ 1 : 10 ]
4 x = repmat([0;0;0;0], m, 1);
5
6 msg = sprintf("extended_powell_gradient1([0;0;0;0;...]) == 0 (m = %d)", m);
7 unit_test_equals(msg, 0, extended_powell_gradient1(x));
8 end
9
10 ## It should fail with the wrong number of coordinates.
11 g = extended_powell_gradient1([1;2;3]);
12 msg = "extended_powell_gradient1 fails when length(x) is odd";
13 unit_test_equals(msg, true, isna(g));