Skip to content
Snippets Groups Projects
Commit 87538b00 authored by Mitchel Humpherys's avatar Mitchel Humpherys
Browse files

lrdp-v2: set up register.py for doctest

register.py is almost ready to handle doctest testing. Fix up one typo
and add the necessary call in if __name__ == "__main__".

Change-Id: I0a79060bb3bb58e807e7699ec0c21ef0eddb062d
parent b69a4c8a
No related branches found
No related tags found
No related merge requests found
...@@ -43,7 +43,7 @@ class Register(object): ...@@ -43,7 +43,7 @@ class Register(object):
You can also overlay fields on top of each other without problems: You can also overlay fields on top of each other without problems:
>>> abc.add_field("another_other", (8, 0)) >>> abc.add_field("another_other", (8, 0))
abc.another_other = 0x5 >>> abc.another_other = 0x5
>>> hex(abc.value) >>> hex(abc.value)
'0x5' '0x5'
...@@ -116,3 +116,7 @@ class Register(object): ...@@ -116,3 +116,7 @@ class Register(object):
val = bitops.bvalsel(msb, lsb, self.value) val = bitops.bvalsel(msb, lsb, self.value)
ret.append('%s[%d:%d]=>0x%0x' % (r, msb, lsb, val)) ret.append('%s[%d:%d]=>0x%0x' % (r, msb, lsb, val))
return 'value: 0x%x {%s}' % (self.value, ', '.join(ret)) return 'value: 0x%x {%s}' % (self.value, ', '.join(ret))
if __name__ == "__main__":
import doctest
doctest.testmod()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment