Implement size to pdu header

This commit is contained in:
PhatPhuckDave
2024-07-22 22:30:34 +02:00
parent 73c7266a2f
commit 785c742ee2
2 changed files with 11 additions and 0 deletions

View File

@@ -63,3 +63,6 @@ func (p *PDU_HEADER) Decode(data []uint8) error {
} }
return nil return nil
} }
func (p *PDU_HEADER) Size() uint32 {
return 16
}

View File

@@ -441,3 +441,11 @@ func TestDecodeHandlesByteSlicesWithMinimumUint32Values(t *testing.T) {
t.Errorf("Expected command_id to be 0, got %d", p.command_id) t.Errorf("Expected command_id to be 0, got %d", p.command_id)
} }
} }
// region size
func TestSizeReturns16(t *testing.T) {
var p PDU_HEADER
if p.Size() != 16 {
t.Errorf("Expected size to be 16, got %d", p.Size())
}
}