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