refactor: add a test for short reads of floats in skipValue

This commit is contained in:
CJ van den Berg 2026-03-12 19:30:04 +01:00
parent d7c87d0562
commit 9767e2a21b
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -130,6 +130,11 @@ test "cbor.matchI64 error.IntegerTooLarge" {
try expectError(error.IntegerTooLarge, result); try expectError(error.IntegerTooLarge, result);
} }
test "cbor.skipValue truncated float16 returns TooShort" {
const buf = [_]u8{ 0xf9, 0x3C };
try expectError(error.TooShort, match(&buf, any));
}
test "cbor.matchI64 error.IntegerTooSmall large negative" { test "cbor.matchI64 error.IntegerTooSmall large negative" {
var buf = [_]u8{ 0x3B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; var buf = [_]u8{ 0x3B, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
var iter: []const u8 = &buf; var iter: []const u8 = &buf;