Include leftmost bit in elements generation
This commit is contained in:
parent
bddf335a53
commit
2b614b00ef
@ -233,7 +233,7 @@ class State:
|
||||
if v == None or v == 0:
|
||||
return self.base_state_name
|
||||
c = 1
|
||||
for i in range(1, self.__bits):
|
||||
for i in range(self.__bits):
|
||||
if v & c > 0:
|
||||
r.append(self.name(c))
|
||||
c <<= 1
|
||||
|
@ -117,12 +117,13 @@ class TestState(unittest.TestCase):
|
||||
states = State(3, check_alias=False)
|
||||
states.add('foo')
|
||||
states.add('bar')
|
||||
states.add('baz')
|
||||
states.put('abcd')
|
||||
states.set('abcd', states.FOO)
|
||||
states.set('abcd', states.BAR)
|
||||
states.set('abcd', states.BAZ)
|
||||
v = states.state('abcd')
|
||||
s = states.name(v)
|
||||
self.assertEqual(s, '_FOO_BAR')
|
||||
self.assertEqual(s, '_FOO_BAZ')
|
||||
|
||||
|
||||
def test_peek(self):
|
||||
|
Loading…
Reference in New Issue
Block a user