mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
feat:add accept ssz test
Signed-off-by: Chen Kai <281165273grape@gmail.com>
This commit is contained in:
parent
972b369390
commit
12169d3848
1 changed files with 11 additions and 10 deletions
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
"github.com/ethereum/go-ethereum/rlp"
|
||||||
ssz "github.com/ferranbt/fastssz"
|
ssz "github.com/ferranbt/fastssz"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
|
"github.com/prysmaticlabs/go-bitfield"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
@ -166,16 +167,16 @@ func TestOfferAndAcceptMessage(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expected, fmt.Sprintf("0x%x", data))
|
assert.Equal(t, expected, fmt.Sprintf("0x%x", data))
|
||||||
|
|
||||||
// TODO test for accept
|
contentKeyBitlist := bitfield.NewBitlist(8)
|
||||||
|
contentKeyBitlist.SetBitAt(0, true)
|
||||||
|
accept := &Accept{
|
||||||
|
ConnectionId: []byte{0x01, 0x02},
|
||||||
|
ContentKeys: []byte(contentKeyBitlist),
|
||||||
|
}
|
||||||
|
|
||||||
// accept := &Accept{
|
expected = "0x0102060000000101"
|
||||||
// ConnectionId: []byte{0x01, 0x02},
|
|
||||||
// ContentKeys: []byte{1, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
// }
|
|
||||||
|
|
||||||
// expected = "0x0102060000000101"
|
data, err = accept.MarshalSSZ()
|
||||||
|
assert.NoError(t, err)
|
||||||
// data, err = accept.MarshalSSZ()
|
assert.Equal(t, expected, fmt.Sprintf("0x%x", data))
|
||||||
// assert.NoError(t, err)
|
|
||||||
// assert.Equal(t, expected, fmt.Sprintf("0x%x", data))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue