summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2019-10-10 13:00:38 +0200
committerMichal Simek <michal.simek@xilinx.com>2020-01-14 09:05:54 +0100
commit9c6bf1715f6afd97cb9cf79d68cc00a81d5a9efa (patch)
tree8f612d032dcb406b89be7560fe9c45773d68e9b8 /test
parent40128bbd68044c2984b0732f61954fda08b1f370 (diff)
test/py: hush_if_test: Add tests to cover octal/hex values
Extend test suite to cover also automatic octal/hex converstions which haven't been implemented in past. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Acked-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/py/tests/test_hush_if_test.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/py/tests/test_hush_if_test.py b/test/py/tests/test_hush_if_test.py
index bba8d41d96..d117921a6a 100644
--- a/test/py/tests/test_hush_if_test.py
+++ b/test/py/tests/test_hush_if_test.py
@@ -7,6 +7,10 @@ import os
import os.path
import pytest
+# TODO: These tests should be converted to a C test.
+# For more information please take a look at the thread
+# https://lists.denx.de/pipermail/u-boot/2019-October/388732.html
+
pytestmark = pytest.mark.buildconfigspec('hush_parser')
# The list of "if test" conditions to test.
@@ -52,6 +56,33 @@ subtests = (
('test 123 -ge 123', True),
('test 123 -ge 456', False),
+ # Octal tests
+
+ ('test 010 -eq 010', True),
+ ('test 010 -eq 011', False),
+
+ ('test 010 -ne 011', True),
+ ('test 010 -ne 010', False),
+
+ # Hexadecimal tests
+
+ ('test 0x2000000 -gt 0x2000001', False),
+ ('test 0x2000000 -gt 0x2000000', False),
+ ('test 0x2000000 -gt 0x1ffffff', True),
+
+ # Mixed tests
+
+ ('test 010 -eq 10', False),
+ ('test 010 -ne 10', True),
+ ('test 0xa -eq 10', True),
+ ('test 0xa -eq 012', True),
+
+ ('test 2000000 -gt 0x1ffffff', False),
+ ('test 0x2000000 -gt 1ffffff', True),
+ ('test 0x2000000 -lt 1ffffff', False),
+ ('test 0x2000000 -eq 2000000', False),
+ ('test 0x2000000 -ne 2000000', True),
+
('test -z ""', True),
('test -z "aaa"', False),