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