From 21965eb7cefbd328e6dcad689c69d08ff2486c2e Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 23 Feb 2024 12:44:08 +0100
Subject: [PATCH] :bug: ver_less_than.m: account for equality of versions

---
 matlab/utilities/version/ver_greater_than.m |  9 ++++++++-
 matlab/utilities/version/ver_less_than.m    | 14 +++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/matlab/utilities/version/ver_greater_than.m b/matlab/utilities/version/ver_greater_than.m
index 447b4b8a62..13d287a65d 100644
--- a/matlab/utilities/version/ver_greater_than.m
+++ b/matlab/utilities/version/ver_greater_than.m
@@ -59,4 +59,11 @@ ver2='6-unstable-2021-12-18-1227-c43777f6';
 ver1='6-unstable-2021-12-19-1953-d841fc7c';
 t(1)=dassert(ver_greater_than(ver1,ver2),true);
 T = all(t);
-%@eof:4
\ No newline at end of file
+%@eof:4
+
+%@test:5
+ver2='5.5';
+ver1='5.5';
+t(1)=dassert(ver_greater_than(ver1,ver2),false);
+T = all(t);
+%@eof:5
diff --git a/matlab/utilities/version/ver_less_than.m b/matlab/utilities/version/ver_less_than.m
index 76a3dcef2f..4caaa9a4a3 100644
--- a/matlab/utilities/version/ver_less_than.m
+++ b/matlab/utilities/version/ver_less_than.m
@@ -29,7 +29,12 @@ function tf = ver_less_than(ver1, ver2)
 % You should have received a copy of the GNU General Public License
 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 
-tf = true;
+if strcmp(ver1,ver2)
+    tf = false;
+    return
+else
+    tf = true;
+end
 ver1 = strsplit(ver1, {'.', '-'});
 ver2 = strsplit(ver2, {'.', '-'});
 
@@ -131,3 +136,10 @@ ver2='6-unstable-2021-12-19-1953-d841fc7c';
 t(1)=dassert(ver_less_than(ver1,ver2),true);
 T = all(t);
 %@eof:4
+
+%@test:5
+ver1='5.5';
+ver2='5.5';
+t(1)=dassert(ver_less_than(ver1,ver2),false);
+T = all(t);
+%@eof:5
-- 
GitLab