Initial working fully go release

This commit is contained in:
Martino Ferrari
2026-04-30 23:01:01 +02:00
parent 6e51ffc5e1
commit 90669c5fd6
22 changed files with 2950 additions and 196 deletions
+6 -6
View File
@@ -159,7 +159,7 @@ func TestDecodeTimeString(t *testing.T) {
func TestDecodeTimeEnum(t *testing.T) {
hdr := buildTimeHeader(0, 0, 0, 0)
val := []byte{0x00, 0x03, 0x00, 0x00} // enum=3 + 2-byte pad
val := []byte{0x00, 0x00, 0x00, 0x03} // 2-byte RISC pad + enum=3
payload := append(hdr, val...)
tv, ok := proto.DecodeTimeValue(proto.DBRTimeEnum, 1, payload)
@@ -307,14 +307,14 @@ func TestEncodeEventMask(t *testing.T) {
if len(b) != 16 {
t.Fatalf("len = %d, want 16", len(b))
}
// m_mask is at offset 14 (after m_lval[0:4], p_delta[4:8], p_final[8:12], p_count[12:14]).
mask := binary.BigEndian.Uint16(b[14:])
// m_mask is at offset 12 per caProto.h struct mon_info.
mask := binary.BigEndian.Uint16(b[12:])
if mask != proto.DBEDefault {
t.Errorf("mask = 0x%02X, want 0x%02X", mask, proto.DBEDefault)
}
// p_count at [12:14] must be zero.
if pc := binary.BigEndian.Uint16(b[12:]); pc != 0 {
t.Errorf("p_count = %d, want 0", pc)
// m_pad at [14:16] must be zero.
if pad := binary.BigEndian.Uint16(b[14:]); pad != 0 {
t.Errorf("m_pad = %d, want 0", pad)
}
}