Moved the substitute_matrix test into test_utils. All tests pass.