1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-19 10:56:06 -05:00
v2fly/common/serial/numbers_test.go

21 lines
368 B
Go
Raw Normal View History

2017-04-28 14:44:28 -04:00
package serial_test
import (
"testing"
"v2ray.com/core/common"
"v2ray.com/core/common/buf"
. "v2ray.com/core/common/serial"
2017-10-24 10:15:35 -04:00
. "v2ray.com/ext/assert"
2017-04-28 14:44:28 -04:00
)
func TestUint32(t *testing.T) {
2017-10-24 10:15:35 -04:00
assert := With(t)
2017-04-28 14:44:28 -04:00
x := uint32(458634234)
s1 := Uint32ToBytes(x, []byte{})
s2 := buf.New()
common.Must(s2.AppendSupplier(WriteUint32(x)))
2017-10-24 10:15:35 -04:00
assert(s1, Equals, s2.Bytes())
2017-04-28 14:44:28 -04:00
}