numbers_test.go 368 B

1234567891011121314151617181920
  1. package serial_test
  2. import (
  3. "testing"
  4. "v2ray.com/core/common"
  5. "v2ray.com/core/common/buf"
  6. . "v2ray.com/core/common/serial"
  7. . "v2ray.com/ext/assert"
  8. )
  9. func TestUint32(t *testing.T) {
  10. assert := With(t)
  11. x := uint32(458634234)
  12. s1 := Uint32ToBytes(x, []byte{})
  13. s2 := buf.New()
  14. common.Must(s2.AppendSupplier(WriteUint32(x)))
  15. assert(s1, Equals, s2.Bytes())
  16. }