diff options
Diffstat (limited to 'bitbake/lib/bb/tests/utils.py')
-rw-r--r-- | bitbake/lib/bb/tests/utils.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py index cf145f0d7a..507de2de3c 100644 --- a/bitbake/lib/bb/tests/utils.py +++ b/bitbake/lib/bb/tests/utils.py | |||
@@ -55,3 +55,36 @@ class VerCmpString(unittest.TestCase): | |||
55 | result = bb.utils.explode_dep_versions2("foo ( =1.10 )") | 55 | result = bb.utils.explode_dep_versions2("foo ( =1.10 )") |
56 | self.assertEqual(result, correctresult) | 56 | self.assertEqual(result, correctresult) |
57 | 57 | ||
58 | def test_vercmp_string_op(self): | ||
59 | compareops = [('1', '1', '=', True), | ||
60 | ('1', '1', '==', True), | ||
61 | ('1', '1', '!=', False), | ||
62 | ('1', '1', '>', False), | ||
63 | ('1', '1', '<', False), | ||
64 | ('1', '1', '>=', True), | ||
65 | ('1', '1', '<=', True), | ||
66 | ('1', '0', '=', False), | ||
67 | ('1', '0', '==', False), | ||
68 | ('1', '0', '!=', True), | ||
69 | ('1', '0', '>', True), | ||
70 | ('1', '0', '<', False), | ||
71 | ('1', '0', '>>', True), | ||
72 | ('1', '0', '<<', False), | ||
73 | ('1', '0', '>=', True), | ||
74 | ('1', '0', '<=', False), | ||
75 | ('0', '1', '=', False), | ||
76 | ('0', '1', '==', False), | ||
77 | ('0', '1', '!=', True), | ||
78 | ('0', '1', '>', False), | ||
79 | ('0', '1', '<', True), | ||
80 | ('0', '1', '>>', False), | ||
81 | ('0', '1', '<<', True), | ||
82 | ('0', '1', '>=', False), | ||
83 | ('0', '1', '<=', True)] | ||
84 | |||
85 | for arg1, arg2, op, correctresult in compareops: | ||
86 | result = bb.utils.vercmp_string_op(arg1, arg2, op) | ||
87 | self.assertEqual(result, correctresult, 'vercmp_string_op("%s", "%s", "%s") != %s' % (arg1, arg2, op, correctresult)) | ||
88 | |||
89 | # Check that clearly invalid operator raises an exception | ||
90 | self.assertRaises(bb.utils.VersionStringException, bb.utils.vercmp_string_op, '0', '0', '$') | ||