27 lines
823 B
Go
27 lines
823 B
Go
package level_test
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/binary"
|
|
"testing"
|
|
|
|
"github.com/inkyblackness/hacked/ss1/content/archive/level"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDefaultBaseInfoSerialized(t *testing.T) {
|
|
buf := bytes.NewBuffer(nil)
|
|
info := level.DefaultBaseInfo(true)
|
|
_ = binary.Write(buf, binary.LittleEndian, &info)
|
|
|
|
data := buf.Bytes()
|
|
assert.Equal(t, 58, len(data), "length mismatch")
|
|
assert.Equal(t, []byte{
|
|
0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
|
|
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
}, data, "data mismatch")
|
|
}
|