mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
corrected slice assign test
This commit is contained in:
parent
693ed3f180
commit
f7d707e4ad
@ -51,7 +51,6 @@ class intbv(object):
|
||||
else:
|
||||
raise TypeError("intbv constructor arg should be int or string")
|
||||
self._checkBounds()
|
||||
|
||||
|
||||
def _checkBounds(self):
|
||||
if self._max is not None:
|
||||
@ -62,7 +61,6 @@ class intbv(object):
|
||||
if self._val < self._min:
|
||||
raise ValueError("intbv value %s < minimum %s" %
|
||||
(self._val, self._min))
|
||||
|
||||
|
||||
# concat method
|
||||
def concat(self, *args):
|
||||
|
@ -56,26 +56,26 @@ class TestIntbvBounds(TestCase):
|
||||
def testSliceAssign(self):
|
||||
a = intbv(min=-24, max=34)
|
||||
for i in (-24, -2, 13, 33):
|
||||
a[:] = i
|
||||
a[10:] = i
|
||||
for k in (0, 9, 10):
|
||||
a[k:] = i
|
||||
for i in (-25, -128, 34, 35, 229):
|
||||
for k in (0, 9, 10):
|
||||
try:
|
||||
a[k:] = i
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self.fail()
|
||||
a = intbv(5)[8:]
|
||||
for v in (0, 2**8-1, 100):
|
||||
a[:] = v
|
||||
for v in (-1, 2**8, -10, 1000):
|
||||
try:
|
||||
a[:] = i
|
||||
a[10:] = i
|
||||
a[:] = v
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self.fail()
|
||||
a = intbv(5)[8:]
|
||||
a[:] = 0
|
||||
a[:] = 2**8-1
|
||||
try:
|
||||
a[:] = -1
|
||||
a[:] = 2**8
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
self.fail()
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user