diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /bitbake/lib/bb/tests/utils.py | |
download | poky-c527fd1f14c27855a37f2e8ac5346ce8d940ced2.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'bitbake/lib/bb/tests/utils.py')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py new file mode 100644 index 0000000000..7c50b1d786 --- /dev/null +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -0,0 +1,53 @@ | |||
1 | # ex:ts=4:sw=4:sts=4:et | ||
2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
3 | # | ||
4 | # BitBake Tests for utils.py | ||
5 | # | ||
6 | # Copyright (C) 2012 Richard Purdie | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License version 2 as | ||
10 | # published by the Free Software Foundation. | ||
11 | # | ||
12 | # This program is distributed in the hope that it will be useful, | ||
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | # GNU General Public License for more details. | ||
16 | # | ||
17 | # You should have received a copy of the GNU General Public License along | ||
18 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
19 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
20 | # | ||
21 | |||
22 | import unittest | ||
23 | import bb | ||
24 | |||
25 | class VerCmpString(unittest.TestCase): | ||
26 | |||
27 | def test_vercmpstring(self): | ||
28 | result = bb.utils.vercmp_string('1', '2') | ||
29 | self.assertTrue(result < 0) | ||
30 | result = bb.utils.vercmp_string('2', '1') | ||
31 | self.assertTrue(result > 0) | ||
32 | result = bb.utils.vercmp_string('1', '1.0') | ||
33 | self.assertTrue(result < 0) | ||
34 | result = bb.utils.vercmp_string('1', '1.1') | ||
35 | self.assertTrue(result < 0) | ||
36 | result = bb.utils.vercmp_string('1.1', '1_p2') | ||
37 | self.assertTrue(result < 0) | ||
38 | |||
39 | def test_explode_dep_versions(self): | ||
40 | correctresult = {"foo" : ["= 1.10"]} | ||
41 | result = bb.utils.explode_dep_versions2("foo (= 1.10)") | ||
42 | self.assertEqual(result, correctresult) | ||
43 | result = bb.utils.explode_dep_versions2("foo (=1.10)") | ||
44 | self.assertEqual(result, correctresult) | ||
45 | result = bb.utils.explode_dep_versions2("foo ( = 1.10)") | ||
46 | self.assertEqual(result, correctresult) | ||
47 | result = bb.utils.explode_dep_versions2("foo ( =1.10)") | ||
48 | self.assertEqual(result, correctresult) | ||
49 | result = bb.utils.explode_dep_versions2("foo ( = 1.10 )") | ||
50 | self.assertEqual(result, correctresult) | ||
51 | result = bb.utils.explode_dep_versions2("foo ( =1.10 )") | ||
52 | self.assertEqual(result, correctresult) | ||
53 | |||