Switches to bash script for packaging.
[giterdone.git] / giterdonetest / commontest.py
blobd675791ffdafbe9f74bf247653a7d71cec73b866
1 # Copyright 2011 Robert Lopez Toscano
3 # This file is part of Giterdone.
5 # Giterdone is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # any later version.
10 # Giterdone is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Giterdone. If not, see <http://www.gnu.org/licenses/>.
18 import sys
19 import os.path
20 common_dir = os.path.join(
21 os.path.dirname(os.path.dirname(os.path.realpath(__file__))),
22 'giterdone')
23 sys.path.append(common_dir)
25 import common
26 import unittest
28 class CommonTestCase(unittest.TestCase):
30 def test_compare_versions_v1_greater(self):
31 v1 = (1,2,10)
32 v2 = (1,2,9)
33 self.assertTrue(common.compare_versions(v1, v2) > 0)
35 v1 = (1,2,10)
36 v2 = (0,3,99)
37 self.assertTrue(common.compare_versions(v1, v2) > 0)
39 def test_compare_versions_v2_greater(self):
40 v1 = (1,2,9)
41 v2 = (1,2,10)
42 self.assertTrue(common.compare_versions(v1, v2) < 0)
44 v1 = (0,3,99)
45 v2 = (1,2,10)
46 self.assertTrue(common.compare_versions(v1, v2) < 0)
48 def test_compare_versions_equal(self):
49 v1 = (1,1,1)
50 v2 = (1,1,1)
51 self.assertTrue(common.compare_versions(v1, v2) == 0)
53 v1 = (1,0,11)
54 v2 = (1,0,11)
55 self.assertTrue(common.compare_versions(v1, v2) == 0)
57 if __name__ == '__main__':
58 unittest.main()