base: add tests

This commit is contained in:
aler9
2021-04-11 18:12:08 +02:00
parent 113935ab47
commit 2e5aef4c12
2 changed files with 63 additions and 7 deletions

View File

@@ -79,12 +79,12 @@ func (f *InterleavedFrame) Read(br *bufio.Reader) error {
}
if header[0] != interleavedFrameMagicByte {
return fmt.Errorf("wrong magic byte (0x%.2x)", header[0])
return fmt.Errorf("invalid magic byte (0x%.2x)", header[0])
}
framelen := int(binary.BigEndian.Uint16(header[2:]))
if framelen > len(f.Payload) {
return fmt.Errorf("frame length greater than maximum allowed (%d vs %d)",
return fmt.Errorf("payload size greater than maximum allowed (%d vs %d)",
framelen, len(f.Payload))
}