mirror of
https://github.com/logos-blockchain/logos-blockchain-specs.git
synced 2026-01-04 06:03:10 +00:00
Creating a bitarray
This commit is contained in:
parent
6518350ff4
commit
fe9d1ecbbe
@ -15,3 +15,38 @@ class TestCountOnBitarrayFields(unittest.TestCase):
|
|||||||
self.assertEqual(result, expected_result)
|
self.assertEqual(result, expected_result)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TestCreateCommitteeBitArray(unittest.TestCase):
|
||||||
|
class Vote:
|
||||||
|
def __init__(self, voter):
|
||||||
|
self.voter = voter
|
||||||
|
|
||||||
|
def test_createCommitteeBitArray_with_smaller_committee_size(self):
|
||||||
|
voters = [
|
||||||
|
self.Vote("Alice"),
|
||||||
|
self.Vote("Bob"),
|
||||||
|
self.Vote("Charlie")
|
||||||
|
]
|
||||||
|
committee_size = 2
|
||||||
|
|
||||||
|
try:
|
||||||
|
result = createCommitteeBitArray(voters, committee_size)
|
||||||
|
self.fail("AssertionError should have been raised.")
|
||||||
|
except AssertionError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def test_createCommitteeBitArray_with_larger_committee_size(self):
|
||||||
|
voters = [
|
||||||
|
self.Vote("Alice"),
|
||||||
|
self.Vote("Bob"),
|
||||||
|
self.Vote("Charlie"),
|
||||||
|
self.Vote("Dave"),
|
||||||
|
self.Vote("Eve")
|
||||||
|
]
|
||||||
|
committee_size = 6
|
||||||
|
|
||||||
|
result = createCommitteeBitArray(voters, committee_size)
|
||||||
|
expected_result = [True, True, True, True, True, False]
|
||||||
|
|
||||||
|
self.assertEqual(result, expected_result)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user