12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- package test
- import (
- "encoding/hex"
- "fmt"
- "strings"
- "testing"
- )
- /*
- 设备<-平台
- */
- func R(b []byte) []byte {
- return b
- }
- // 设备 返回处理结果
- func R_reply(b []byte) []byte {
- return b
- }
- /*
- 设备->平台
- */
- func T(b []byte) []byte {
- return b
- }
- // 平台 返回处理结果
- func T_reply(b []byte) []byte {
- return b
- }
- var Data_hex = true
- var R_byte = "495051"
- var T_byte = "456"
- func TestNameq(t *testing.T) {
- R_ := []byte(R_byte)
- if Data_hex {
- R_, _ = hex.DecodeString(R_byte)
- R_ = R(R_)
- fmt.Print("|-=&" + strings.ToUpper(hex.EncodeToString(R_)))
- } else {
- R_ = R(R_)
- fmt.Print("|-=&" + string(R_))
- }
- fmt.Print("|-=&" + string(R_reply([]byte("{\n \"id\": \"****\",\n \"code\":200,\n \"data\" : {}\n}"))))
- // -------------------------------
- T_ := []byte(T_byte)
- if Data_hex {
- T_, _ = hex.DecodeString(T_byte)
- T_ = T(T_)
- fmt.Print("|-=&" + strings.ToUpper(hex.EncodeToString(T_)))
- } else {
- T_ = T(T_)
- fmt.Print("|-=&" + string(T_))
- }
- fmt.Print("|-=&" + string(T_reply([]byte("{\n \"id\": \"****\",\n \"code\":200,\n \"data\" : {}\n}"))))
- }
|