Esempio n. 1
0
func Test_LongBox_Write(t *testing.T) {
	data := []byte{0xba, 0x6c, 0x7, 0x22, 0xda, 0xbc, 0x34, 0x13, 0x0, 0x0, 0x0, 0x0}
	i := builtin.NewLong(322223322)

	var buff = new(bytes.Buffer)
	proto := bin.NewEncoder(buff)

	assert.NoError(t, i.Box().Write(proto))
	assert.Equal(t, data, buff.Bytes())
}
Esempio n. 2
0
func Test_LongBoxRead(t *testing.T) {
	data := []byte{0xba, 0x6c, 0x7, 0x22, 0xda, 0xbc, 0x34, 0x13, 0x0, 0x0, 0x0, 0x0}
	val := builtin.NewLong(322223322)

	proto := bin.NewDecoder(bytes.NewBuffer(data))

	res := (&builtin.Long{}).Box()
	assert.NoError(t, res.Read(proto, nil, uuid.UUID{}))
	assert.Equal(t, val, res.Strip())
}
Esempio n. 3
0
func Test_Long_Value(t *testing.T) {
	i := builtin.NewLong(322223322)
	res := i.Strip()
	assert.Equal(t, int64(322223322), res)
}