summaryrefslogtreecommitdiff
path: root/tools/dtoc
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-18 07:00:41 +0300
committerSimon Glass <sjg@chromium.org>2019-07-11 01:52:58 +0300
commitb5f0dafd4b66f8fde3c968ec20186bc8465558b8 (patch)
tree2817c50d81371eb55b37976b84ba45f72b312f98 /tools/dtoc
parente66d318fef611241749d37b6b73ff80c84a8c866 (diff)
downloadu-boot-b5f0dafd4b66f8fde3c968ec20186bc8465558b8.tar.xz
dtoc: Add a unit test for BytesToValue()
Add a simple unit test for one of the cases of this function, so that any fault can be seen directly, rather than appearing through the failure of another test. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc')
-rwxr-xr-xtools/dtoc/test_fdt.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index a5234ce1e8..32a020bad2 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -19,7 +19,7 @@ for dirname in ['../patman', '..']:
import command
import fdt
-from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL
+from fdt import TYPE_BYTE, TYPE_INT, TYPE_STRING, TYPE_BOOL, BytesToValue
import fdt_util
from fdt_util import fdt32_to_cpu
import libfdt
@@ -121,6 +121,10 @@ class TestFdt(unittest.TestCase):
node = self.dtb.GetNode('/spl-test')
self.assertEqual(self.dtb, node.GetFdt())
+ def testBytesToValue(self):
+ self.assertEqual(BytesToValue(b'this\0is\0'),
+ (TYPE_STRING, ['this', 'is']))
+
class TestNode(unittest.TestCase):
"""Test operation of the Node class"""