X-Git-Url: http://gitweb.michael.orlitzky.com/?p=octave.git;a=blobdiff_plain;f=tests%2Frosenbrock1_tests.m;fp=tests%2Frosenbrock1_tests.m;h=493140313fd7587ec93224ee68dae580a36c6cbf;hp=0000000000000000000000000000000000000000;hb=75563505172dce2cc78116f0884819ca32620dbe;hpb=1e0c72bb336872f0839305340eb9699a87a40319 diff --git a/tests/rosenbrock1_tests.m b/tests/rosenbrock1_tests.m new file mode 100644 index 0000000..4931403 --- /dev/null +++ b/tests/rosenbrock1_tests.m @@ -0,0 +1,16 @@ +## Test the optimal point. + +unit_test_equals("rosenbrock1([1;1]) == 0", ... + 0, ... + rosenbrock1([1;1])); + +## It should fail with the wrong number of coordinates. +f = rosenbrock1([1]); +unit_test_equals("rosenbrock1 fails with too few coordinates", ... + true, ... + isna(f)); + +f = rosenbrock1([1;2;3]); +unit_test_equals("rosenbrock1 fails with too many coordinates", ... + true, ... + isna(f));