mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 22:06:21 +00:00
ee89ef1c79
* add simple bitfield type (fixes #19) * fix bit endianess to match spec * consolidate attestation and block logging * cruft cleanup * run optimizer on tests, speeds up build
28 lines
447 B
Nim
28 lines
447 B
Nim
import
|
|
unittest,
|
|
../beacon_chain/spec/[bitfield]
|
|
|
|
suite "BitField":
|
|
test "roundtrips":
|
|
var
|
|
a = BitField.init(100)
|
|
b = BitField.init(100)
|
|
|
|
check:
|
|
not a.get_bitfield_bit(0)
|
|
|
|
a.set_bitfield_bit(1)
|
|
|
|
check:
|
|
not a.get_bitfield_bit(0)
|
|
a.get_bitfield_bit(1)
|
|
|
|
b.set_bitfield_bit(2)
|
|
|
|
a.combine(b)
|
|
|
|
check:
|
|
not a.get_bitfield_bit(0)
|
|
a.get_bitfield_bit(1)
|
|
a.get_bitfield_bit(2)
|