diff --git a/tests/solver-test-functions/helicalvalley.m b/tests/solver-test-functions/helicalvalley.m
index c4b39bf427336f3427bf132e337984279371c302..a10d3bd77f3c327298a43d03fbe5e7d7065d1ed0 100644
--- a/tests/solver-test-functions/helicalvalley.m
+++ b/tests/solver-test-functions/helicalvalley.m
@@ -49,7 +49,7 @@ if nargin==1
         fjac(3,2) = 0;
         fjac(3,3) = 1;
     end
-elseif nargin
+elseif ~nargin
     if nargout==1
         fval = [-1; 0; 0];
     else
diff --git a/tests/solver-test-functions/powell1.m b/tests/solver-test-functions/powell1.m
index b021bf10773098d2b2a34f55298789cfee9bfbe4..4117ea7d5f8686e87d653ae223e8023dc0c73582 100644
--- a/tests/solver-test-functions/powell1.m
+++ b/tests/solver-test-functions/powell1.m
@@ -36,7 +36,7 @@ if nargin==1
         fjac(4,1) = 2*sqrt(10)*(x(1)-x(4));
         fjac(4,4) = -fjac(4,1);
     end
-elseif nargin
+elseif ~nargin
     if nargout==1
         fval = [3; -1; 0; 1];
     else
diff --git a/tests/solver-test-functions/powell2.m b/tests/solver-test-functions/powell2.m
index 52b5f5ba7852a5832153a34e7dc8938fb0288a18..29c6ed9d8434b6fdaff8c62974bd40e68e7d5338 100644
--- a/tests/solver-test-functions/powell2.m
+++ b/tests/solver-test-functions/powell2.m
@@ -28,7 +28,7 @@ if nargin==1
         fjac(2,1) = -exp(x(1));
         fjac(2,2) = -exp(x(2));
     end
-elseif nargin
+elseif ~nargin
     if nargout==1
         fval = [0; 1];
     else
diff --git a/tests/solver-test-functions/rosenbrock.m b/tests/solver-test-functions/rosenbrock.m
index 337fceb20f73ceb90d6584f0b70acdb7c746107d..b727eb44f8d608ab9d7d2763e5a36a718678d048 100644
--- a/tests/solver-test-functions/rosenbrock.m
+++ b/tests/solver-test-functions/rosenbrock.m
@@ -28,7 +28,7 @@ if nargin==1
         fjac(2,1) = -20*x(1);
         fjac(2,2) = 10;
     end
-elseif nargin
+elseif ~nargin
     if nargout==1
         fval = [10000; 1];
     else
diff --git a/tests/solver-test-functions/wood.m b/tests/solver-test-functions/wood.m
index 04ff2b9de7c4ae83fe5aa49cee3e62e3b36cdebd..1aa7b60ebac4c52bf932a73432ae35c25de70b32 100644
--- a/tests/solver-test-functions/wood.m
+++ b/tests/solver-test-functions/wood.m
@@ -45,7 +45,7 @@ if nargin==1
         fjac(4,3) = -2*C6*x(3);
         fjac(4,4) = C6+C4;
     end
-elseif nargin
+elseif ~nargin
     if nargout==1
         fval = [-3; -1; -3; -1];
     else