summaryrefslogtreecommitdiff
path: root/test/update_checker_test.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-01-24 00:12:45 +0000
committerCarl Hetherington <cth@carlh.net>2015-01-24 00:12:45 +0000
commit1e4f8cc123ccf1661ea4d23a51625614c2cf2e59 (patch)
tree0abbbfac2097b52640ce447bc8fdc93e1939233e /test/update_checker_test.cc
parent68f662ac50a00ad986e3bd258c3f7daac374ab26 (diff)
Hand-apply d4470377df181b4d15fbac86c454a8372b1a0f3d; fix update checker.
Diffstat (limited to 'test/update_checker_test.cc')
-rw-r--r--test/update_checker_test.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/update_checker_test.cc b/test/update_checker_test.cc
new file mode 100644
index 000000000..c9a44993c
--- /dev/null
+++ b/test/update_checker_test.cc
@@ -0,0 +1,36 @@
+/*
+ Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <boost/test/unit_test.hpp>
+#include "lib/update.h"
+
+BOOST_AUTO_TEST_CASE (update_checker_test)
+{
+ BOOST_CHECK (UpdateChecker::version_less_than ("0.0.1", "0.0.2"));
+ BOOST_CHECK (UpdateChecker::version_less_than ("1.0.1", "2.0.2"));
+ BOOST_CHECK (UpdateChecker::version_less_than ("0.1.1", "1.5.2"));
+ BOOST_CHECK (UpdateChecker::version_less_than ("1.9.45", "1.9.46"));
+
+ BOOST_CHECK (!UpdateChecker::version_less_than ("0.0.1", "0.0.1"));
+ BOOST_CHECK (!UpdateChecker::version_less_than ("2.0.2", "1.0.1"));
+ BOOST_CHECK (!UpdateChecker::version_less_than ("1.5.2", "0.1.1"));
+ BOOST_CHECK (!UpdateChecker::version_less_than ("1.9.46", "1.9.45"));
+
+ BOOST_CHECK (!UpdateChecker::version_less_than ("1.9.46devel", "1.9.46"));
+}