Add tests for pyalpm.vercmp function. The tests are mostly taken from `man vercmp`. Signed-off-by: Jelle van der Waa <jelle@vdwaa.nl> --- tests/test_vercmp.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_vercmp.py diff --git a/tests/test_vercmp.py b/tests/test_vercmp.py new file mode 100644 index 0000000..8c42466 --- /dev/null +++ b/tests/test_vercmp.py @@ -0,0 +1,21 @@ +import unittest +import pyalpm + + +class vercmp(unittest.TestCase): + + def test_smaller(self): + self.assertEqual(pyalpm.vercmp('1', '2'), -1) + + def test_greater(self): + self.assertEqual(pyalpm.vercmp('2', '1'), 1) + self.assertEqual(pyalpm.vercmp('2.0-1', '1.7-6'), 1) + + def test_equal(self): + self.assertEqual(pyalpm.vercmp('1', '1'), 0) + self.assertEqual(pyalpm.vercmp('1.0', '1.0-10'), 0) + + def test_epoch(self): + self.assertEqual(pyalpm.vercmp('4.34', '1:001'), -1) + +# vim: set ts=4 sw=4 et: -- 2.10.1