[jhbuild] tests: Add test_compare_version
- From: Craig Keogh <cskeogh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] tests: Add test_compare_version
- Date: Sun, 18 Dec 2011 10:01:26 +0000 (UTC)
commit e57ed0430baf509ceb0007cdbab343519e9a231e
Author: Craig Keogh <cskeogh adam com au>
Date: Sun Dec 18 20:28:42 2011 +1030
tests: Add test_compare_version
tests/tests.py | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/tests/tests.py b/tests/tests.py
index 0b623a6..6980ca3 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -45,6 +45,7 @@ from jhbuild.modtypes.distutils import DistutilsModule
import jhbuild.config
import jhbuild.frontends.terminal
import jhbuild.moduleset
+import jhbuild.utils.cmds
def uencode(s):
@@ -593,6 +594,27 @@ class EndToEndTest(JhbuildConfigTestCase):
self.assertEquals(stdout.strip(), 'Hello world (library test)')
self.assertEquals(proc.wait(), 0)
+class UtilsTest(JhbuildConfigTestCase):
+
+ def test_compare_version(self):
+ self.assertTrue(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '3'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '3.12'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '3.13.1'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '4'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '3.14'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('3.13.1.with.ckbi.1.88', '3.13.2'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('3with', '3.1'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('3with', '2'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('with3', '3.1'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('with3', '2'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('3.with', '3.1'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('3.with', '3'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('0.5', '0.6'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('0.5', '0.5'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('1', '1.2.3.4'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('1.2.3.4', '1'))
+ self.assertTrue(jhbuild.utils.cmds.compare_version('2', '1.2.3.4'))
+ self.assertFalse(jhbuild.utils.cmds.compare_version('1.2.3.4', '2'))
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]