package btm_vobc import ( "bytes" "encoding/hex" "fmt" "sync/atomic" "testing" ) const ( code1 = "fffef890149e75e15511000006230000000000d4da14ebfffd" code2 = "fffee601804f004d00800600002a004984ec6f4e902ef6912284000000000000000000000000000000067e000000000000411b0000f5bbee397698fffd" ) var message_id atomic.Uint32 func TestDecode(t *testing.T) { fmt.Println(code1[:4]) d, _ := hex.DecodeString(code1) fmt.Println(d[:2]) dd := d[2 : len(d)-2] fmt.Println(hex.EncodeToString(dd)) fmt.Println(bytes.Equal(d[:2], []byte{0xff, 0xfe})) fmt.Println(message_id.Load()) } func TestMsg(t *testing.T) { index := 1 for i := 22; i <= 125; i++ { fmt.Println(index) index++ } } func TestBytes(t *testing.T) { s := "90007F8181B60B10183280003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" d, _ := hex.DecodeString(s) fmt.Println(len(d)) }