1
0
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:
jand 2003-07-04 21:11:15 +00:00
parent 693ed3f180
commit f7d707e4ad
2 changed files with 14 additions and 16 deletions

View File

@ -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):

View File

@ -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()