]> gitweb.michael.orlitzky.com - octave.git/blobdiff - tests/extended_powell1_tests.m
Add extended_powell functions and their tests.
[octave.git] / tests / extended_powell1_tests.m
diff --git a/tests/extended_powell1_tests.m b/tests/extended_powell1_tests.m
new file mode 100644 (file)
index 0000000..990eae6
--- /dev/null
@@ -0,0 +1,14 @@
+## Test the optimal point.
+
+for m = [ 1 : 10 ]
+  x = repmat([0;0;0;0], m, 1);
+
+  msg = sprintf("extended_powell1([0;0;0;0...]) == 0 (m = %d)", m);
+  unit_test_equals(msg, 0, extended_powell1(x));
+end
+
+## It should fail with the wrong number of coordinates.
+f = extended_powell1([1]);
+unit_test_equals("extended_powell1 fails when length(x) is odd", ...
+                true, ...
+                isna(f));