func Test_DoubleBox_Write(t *testing.T) { data := []byte{0x54, 0xc1, 0x10, 0x22, 0xef, 0xc9, 0xc3, 0x42, 0x95, 0x77, 0xdf, 0x40} i := builtin.NewDouble(32222.3322) var buff = new(bytes.Buffer) proto := bin.NewEncoder(buff) assert.NoError(t, i.Box().Write(proto)) assert.Equal(t, data, buff.Bytes()) }
func Test_DoubleBoxRead(t *testing.T) { data := []byte{0x54, 0xc1, 0x10, 0x22, 0xef, 0xc9, 0xc3, 0x42, 0x95, 0x77, 0xdf, 0x40} val := builtin.NewDouble(32222.3322) proto := bin.NewDecoder(bytes.NewBuffer(data)) res := (&builtin.Double{}).Box() assert.NoError(t, res.Read(proto, nil, uuid.UUID{})) assert.Equal(t, val, res.Strip()) }
func Test_Double_Value(t *testing.T) { i := builtin.NewDouble(32222.3322) res := i.Strip() assert.Equal(t, float64(32222.3322), res) }