]> gitweb.michael.orlitzky.com - octave.git/blobdiff - tests/advection_matrix_tests.m
Add the advection_matrix() function and a test for it.
[octave.git] / tests / advection_matrix_tests.m
diff --git a/tests/advection_matrix_tests.m b/tests/advection_matrix_tests.m
new file mode 100644 (file)
index 0000000..7509b07
--- /dev/null
@@ -0,0 +1,13 @@
+## Try a 4x4 advection matrix. See the docstring in advection_matrix.m
+## for an explanation of the expected result.
+
+expected = (1/2) * [  0,  1,  0, -1; ...
+                    -1,  0,  1,  0; ...
+                     0, -1,  0,  1; ...
+                     1,  0, -1,  0 ];
+
+actual = advection_matrix(4, 0, 1);
+
+unit_test_equals("4x4 advection matrix is correct", ...
+                true, ...
+                expected == actual);