main_test.go 614 B

123456789101112131415161718192021222324252627282930
  1. package yu_pack
  2. import (
  3. "fmt"
  4. "testing"
  5. )
  6. func TestPack_SetBytes(t *testing.T) {
  7. j_pack := New()
  8. j_pack.PushString("asdsa")
  9. j_pack.PushString("asdsa")
  10. j_pack.PushString("asdsa")
  11. j_pack.PushString("asdsa")
  12. j_s := j_pack.String()
  13. j_ss, _ := j_pack.PopString(6)
  14. fmt.Println(j_s, j_ss)
  15. j_pack.Reset()
  16. j_pack.PushString("123123")
  17. j_pack.PushString("123123")
  18. j_pack.PushString("3213123")
  19. j_pack.PushString("312312")
  20. fmt.Println(j_s, j_ss)
  21. j_s = j_pack.String()
  22. j_ss, _ = j_pack.PopString(6)
  23. fmt.Println(j_s, j_ss)
  24. j_pack.Reset().PushInt16B(0x0810, 0x0307, 0x0387)
  25. fmt.Println(j_pack.Bytes())
  26. }