Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81c0b910 authored by Henri Chataing's avatar Henri Chataing
Browse files

pdl: Define exhaustive array tests

Add test constructs for all possible array types
based on the combination of type (byte, scalar, enum,
static struct, dynamic struct) and size (constant,
with size field, with count field, undefined)

Test: atest --host pdl_python_generator_test
Change-Id: Ide5f90fa18e7be17660f3c45c4d6972662556127
parent e2e089fa
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -310,6 +310,8 @@ class FieldParser:
            self.append_(f"fields['{field.id}'] = {field.id}")
            if size is not None:
                self.append_(f"span = span[{size}:]")
            else:
                self.append_(f"span = bytes()")

        # Drop the padding
        if padded_size:
@@ -631,17 +633,20 @@ class FieldSerializer:
                size_modifier = f' + {value_field.size_modifier}'

            if isinstance(value_field, (ast.PayloadField, ast.BodyField)):
                self.append_(f"_size = len(payload or self.payload or []){size_modifier}")
                self.append_(f"if _size > {max_size}:")
                self.append_(f"_payload_size = len(payload or self.payload or []){size_modifier}")
                self.append_(f"if _payload_size > {max_size}:")
                self.append_(f"    print(f\"Invalid length for payload field:" +
                             f"  {{_size}} > {max_size}; the packet cannot be generated\")")
                             f"  {{_payload_size}} > {max_size}; the packet cannot be generated\")")
                self.append_(f"    raise Exception(\"Invalid payload length\")")
                array_size = "_size"
                array_size = "_payload_size"
            elif isinstance(value_field, ast.ArrayField) and value_field.width:
                array_size = f"(len(self.{value_field.id}) * {int(value_field.width / 8)}{size_modifier})"
            elif isinstance(value_field, ast.ArrayField) and isinstance(value_field.type, ast.EnumDeclaration):
                array_size = f"(len(self.{value_field.id}) * {int(value_field.type.width / 8)}{size_modifier})"
            elif isinstance(value_field, ast.ArrayField):
                self.append_(f"_size = sum([elt.size for elt in self.{value_field.id}]){size_modifier}")
                array_size = "_size"
                self.append_(
                    f"_{value_field.id}_size = sum([elt.size for elt in self.{value_field.id}]){size_modifier}")
                array_size = f"_{value_field.id}_size"
            else:
                raise Exception("Unsupported field type")
            self.value.append(f"({array_size} << {shift})")
+196 −92
Original line number Diff line number Diff line
@@ -218,76 +218,113 @@ packet Packet_Custom_Field_VariableSize {
    a: UnsizedCustomField,
}

// Array fields
// Array element types
// Array field configurations.
// Add constructs for all configurations of type, size, and padding:
//
// - type: u8, u16, enum, struct with static size, struct with dynamic size
// - size: constant, with size field, with count field, unspecified
//
// The type u8 is tested separately since it is likely to be handled
// idiomatically by the specific language generators.

// Array with scalar elements.
packet Packet_Array_Field_ScalarElement {
    array: 16[4],
packet Packet_Array_Field_ByteElement_ConstantSize {
    array: 8[4],
}

// Array with enum elements.
packet Packet_Array_Field_EnumElement {
    array: Enum16[4],
packet Packet_Array_Field_ByteElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 8[],
}

// Array with sized structure elements.
packet Packet_Array_Field_SizedStructElement {
    array: SizedStruct[4],
packet Packet_Array_Field_ByteElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: 8[],
}

// Array with variable sized structure elements.
packet Packet_Array_Field_UnsizedStructElement {
    array: UnsizedStruct[4],
packet Packet_Array_Field_ByteElement_UnknownSize {
    array: 8[],
}

// Array configurations
packet Packet_Array_Field_ScalarElement_ConstantSize {
    array: 16[4],
}

// Array with sized elements, and a variable count.
// The parser must extract as many elements as specified by the count from
// the remaining span. The parser should generate a dynamic array size guard.
packet Packet_Array_Field_SizedElement_VariableCount {
packet Packet_Array_Field_ScalarElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
}

packet Packet_Array_Field_ScalarElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: 16[],
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
packet Packet_Array_Field_SizedElement_VariableSize {
packet Packet_Array_Field_ScalarElement_UnknownSize {
    array: 16[],
}

packet Packet_Array_Field_EnumElement_ConstantSize {
    array: Enum16[4],
}

packet Packet_Array_Field_EnumElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
    array: Enum16[],
}

packet Packet_Array_Field_EnumElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: Enum16[],
}

packet Packet_Array_Field_EnumElement_UnknownSize {
    array: Enum16[],
}

// The parser must extract as many elements as specified by the
// static array count. The parser should generate a static array size guard.
packet Packet_Array_Field_SizedElement_ConstantSize {
    array: 16[8],
    array: SizedStruct[4],
}

// The parser must extract as many elements as specified by the count from
// the remaining span. No size guard possible.
packet Packet_Array_Field_UnsizedElement_VariableCount {
packet Packet_Array_Field_SizedElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: SizedStruct[],
}

packet Packet_Array_Field_SizedElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
    array: SizedStruct[],
}

packet Packet_Array_Field_SizedElement_UnknownSize {
    array: SizedStruct[],
}

packet Packet_Array_Field_UnsizedElement_ConstantSize {
    array: UnsizedStruct[4],
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
packet Packet_Array_Field_UnsizedElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}

// The parser must extract as many elements as specified by the
// static array count. No size guard possible.
packet Packet_Array_Field_UnsizedElement_ConstantSize {
    array: UnsizedStruct[8],
packet Packet_Array_Field_UnsizedElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}

packet Packet_Array_Field_UnsizedElement_UnknownSize {
    array: UnsizedStruct[],
}

// The parser must support complex size modifiers on arrays whose size is
@@ -497,90 +534,150 @@ packet Struct_Custom_Field_VariableSize {
    s: Struct_Custom_Field_VariableSize_,
}

// Array fields
// Array element types
// Array field configurations.
// Add constructs for all configurations of type, size, and padding:
//
// - type: u8, u16, enum, struct with static size, struct with dynamic size
// - size: constant, with size field, with count field, unspecified
//
// The type u8 is tested separately since it is likely to be handled
// idiomatically by the specific language generators.

// Array with scalar elements.
struct Struct_Array_Field_ScalarElement_ {
    array: 16[4],
struct Struct_Array_Field_ByteElement_ConstantSize_ {
    array: 8[4],
}
packet Struct_Array_Field_ScalarElement {
    s: Struct_Array_Field_ScalarElement_,
packet Struct_Array_Field_ByteElement_ConstantSize {
    s: Struct_Array_Field_ByteElement_ConstantSize_,
}

// Array with enum elements.
struct Struct_Array_Field_EnumElement_ {
    array: Enum16[4],
struct Struct_Array_Field_ByteElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 8[],
}
packet Struct_Array_Field_EnumElement {
    s: Struct_Array_Field_EnumElement_,
packet Struct_Array_Field_ByteElement_VariableSize {
    s: Struct_Array_Field_ByteElement_VariableSize_,
}

// Array with sized structure elements.
struct Struct_Array_Field_SizedStructElement_ {
    array: SizedStruct[4],
struct Struct_Array_Field_ByteElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: 8[],
}
packet Struct_Array_Field_SizedStructElement {
    s: Struct_Array_Field_SizedStructElement_,
packet Struct_Array_Field_ByteElement_VariableCount {
    s: Struct_Array_Field_ByteElement_VariableCount_,
}

// Array with variable sized structure elements.
struct Struct_Array_Field_UnsizedStructElement_ {
    array: UnsizedStruct[4],
struct Struct_Array_Field_ByteElement_UnknownSize_ {
    array: 8[],
}
packet Struct_Array_Field_ByteElement_UnknownSize {
    s: Struct_Array_Field_ByteElement_UnknownSize_,
}

struct Struct_Array_Field_ScalarElement_ConstantSize_ {
    array: 16[4],
}
packet Struct_Array_Field_UnsizedStructElement {
    s: Struct_Array_Field_UnsizedStructElement_,
packet Struct_Array_Field_ScalarElement_ConstantSize {
    s: Struct_Array_Field_ScalarElement_ConstantSize_,
}

// Array configurations
struct Struct_Array_Field_ScalarElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
}
packet Struct_Array_Field_ScalarElement_VariableSize {
    s: Struct_Array_Field_ScalarElement_VariableSize_,
}

// Array with sized elements, and a variable count.
// The parser must extract as many elements as specified by the count from
// the remaining span. The parser should generate a dynamic array size guard.
struct Struct_Array_Field_SizedElement_VariableCount_ {
struct Struct_Array_Field_ScalarElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: 16[],
}
packet Struct_Array_Field_SizedElement_VariableCount {
    s: Struct_Array_Field_SizedElement_VariableCount_,
packet Struct_Array_Field_ScalarElement_VariableCount {
    s: Struct_Array_Field_ScalarElement_VariableCount_,
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
struct Struct_Array_Field_SizedElement_VariableSize_ {
struct Struct_Array_Field_ScalarElement_UnknownSize_ {
    array: 16[],
}
packet Struct_Array_Field_ScalarElement_UnknownSize {
    s: Struct_Array_Field_ScalarElement_UnknownSize_,
}

struct Struct_Array_Field_EnumElement_ConstantSize_ {
    array: Enum16[4],
}
packet Struct_Array_Field_EnumElement_ConstantSize {
    s: Struct_Array_Field_EnumElement_ConstantSize_,
}

struct Struct_Array_Field_EnumElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
    array: Enum16[],
}
packet Struct_Array_Field_SizedElement_VariableSize {
    s: Struct_Array_Field_SizedElement_VariableSize_,
packet Struct_Array_Field_EnumElement_VariableSize {
    s: Struct_Array_Field_EnumElement_VariableSize_,
}

struct Struct_Array_Field_EnumElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: Enum16[],
}
packet Struct_Array_Field_EnumElement_VariableCount {
    s: Struct_Array_Field_EnumElement_VariableCount_,
}

struct Struct_Array_Field_EnumElement_UnknownSize_ {
    array: Enum16[],
}
packet Struct_Array_Field_EnumElement_UnknownSize {
    s: Struct_Array_Field_EnumElement_UnknownSize_,
}

// The parser must extract as many elements as specified by the
// static array count. The parser should generate a static array size guard.
struct Struct_Array_Field_SizedElement_ConstantSize_ {
    array: 16[8],
    array: SizedStruct[4],
}
packet Struct_Array_Field_SizedElement_ConstantSize {
    s: Struct_Array_Field_SizedElement_ConstantSize_,
}

// The parser must extract as many elements as specified by the count from
// the remaining span. No size guard possible.
struct Struct_Array_Field_UnsizedElement_VariableCount_ {
struct Struct_Array_Field_SizedElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: SizedStruct[],
}
packet Struct_Array_Field_SizedElement_VariableSize {
    s: Struct_Array_Field_SizedElement_VariableSize_,
}

struct Struct_Array_Field_SizedElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
    array: SizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_VariableCount {
    s: Struct_Array_Field_UnsizedElement_VariableCount_,
packet Struct_Array_Field_SizedElement_VariableCount {
    s: Struct_Array_Field_SizedElement_VariableCount_,
}

struct Struct_Array_Field_SizedElement_UnknownSize_ {
    array: SizedStruct[],
}
packet Struct_Array_Field_SizedElement_UnknownSize {
    s: Struct_Array_Field_SizedElement_UnknownSize_,
}

struct Struct_Array_Field_UnsizedElement_ConstantSize_ {
    array: UnsizedStruct[4],
}
packet Struct_Array_Field_UnsizedElement_ConstantSize {
    s: Struct_Array_Field_UnsizedElement_ConstantSize_,
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
struct Struct_Array_Field_UnsizedElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
@@ -590,13 +687,20 @@ packet Struct_Array_Field_UnsizedElement_VariableSize {
    s: Struct_Array_Field_UnsizedElement_VariableSize_,
}

// The parser must extract as many elements as specified by the
// static array count. No size guard possible.
struct Struct_Array_Field_UnsizedElement_ConstantSize_ {
    array: UnsizedStruct[8],
struct Struct_Array_Field_UnsizedElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_ConstantSize {
    s: Struct_Array_Field_UnsizedElement_ConstantSize_,
packet Struct_Array_Field_UnsizedElement_VariableCount {
    s: Struct_Array_Field_UnsizedElement_VariableCount_,
}

struct Struct_Array_Field_UnsizedElement_UnknownSize_ {
    array: UnsizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_UnknownSize {
    s: Struct_Array_Field_UnsizedElement_UnknownSize_,
}

// The parser must support complex size modifiers on arrays whose size is
+1930 −732

File changed.

Preview size limit exceeded, changes collapsed.

+196 −92
Original line number Diff line number Diff line
@@ -228,76 +228,113 @@ packet Packet_Custom_Field_VariableSize {
    a: UnsizedCustomField,
}

// Array fields
// Array element types
// Array field configurations.
// Add constructs for all configurations of type, size, and padding:
//
// - type: u8, u16, enum, struct with static size, struct with dynamic size
// - size: constant, with size field, with count field, unspecified
//
// The type u8 is tested separately since it is likely to be handled
// idiomatically by the specific language generators.

// Array with scalar elements.
packet Packet_Array_Field_ScalarElement {
    array: 16[4],
packet Packet_Array_Field_ByteElement_ConstantSize {
    array: 8[4],
}

// Array with enum elements.
packet Packet_Array_Field_EnumElement {
    array: Enum16[4],
packet Packet_Array_Field_ByteElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 8[],
}

// Array with sized structure elements.
packet Packet_Array_Field_SizedStructElement {
    array: SizedStruct[4],
packet Packet_Array_Field_ByteElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: 8[],
}

// Array with variable sized structure elements.
packet Packet_Array_Field_UnsizedStructElement {
    array: UnsizedStruct[4],
packet Packet_Array_Field_ByteElement_UnknownSize {
    array: 8[],
}

// Array configurations
packet Packet_Array_Field_ScalarElement_ConstantSize {
    array: 16[4],
}

// Array with sized elements, and a variable count.
// The parser must extract as many elements as specified by the count from
// the remaining span. The parser should generate a dynamic array size guard.
packet Packet_Array_Field_SizedElement_VariableCount {
packet Packet_Array_Field_ScalarElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
}

packet Packet_Array_Field_ScalarElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: 16[],
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
packet Packet_Array_Field_SizedElement_VariableSize {
packet Packet_Array_Field_ScalarElement_UnknownSize {
    array: 16[],
}

packet Packet_Array_Field_EnumElement_ConstantSize {
    array: Enum16[4],
}

packet Packet_Array_Field_EnumElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
    array: Enum16[],
}

packet Packet_Array_Field_EnumElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: Enum16[],
}

packet Packet_Array_Field_EnumElement_UnknownSize {
    array: Enum16[],
}

// The parser must extract as many elements as specified by the
// static array count. The parser should generate a static array size guard.
packet Packet_Array_Field_SizedElement_ConstantSize {
    array: 16[8],
    array: SizedStruct[4],
}

// The parser must extract as many elements as specified by the count from
// the remaining span. No size guard possible.
packet Packet_Array_Field_UnsizedElement_VariableCount {
packet Packet_Array_Field_SizedElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: SizedStruct[],
}

packet Packet_Array_Field_SizedElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
    array: SizedStruct[],
}

packet Packet_Array_Field_SizedElement_UnknownSize {
    array: SizedStruct[],
}

packet Packet_Array_Field_UnsizedElement_ConstantSize {
    array: UnsizedStruct[4],
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
packet Packet_Array_Field_UnsizedElement_VariableSize {
    _size_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}

// The parser must extract as many elements as specified by the
// static array count. No size guard possible.
packet Packet_Array_Field_UnsizedElement_ConstantSize {
    array: UnsizedStruct[8],
packet Packet_Array_Field_UnsizedElement_VariableCount {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}

packet Packet_Array_Field_UnsizedElement_UnknownSize {
    array: UnsizedStruct[],
}

// The parser must support complex size modifiers on arrays whose size is
@@ -535,90 +572,150 @@ packet Struct_Custom_Field_VariableSize {
    s: Struct_Custom_Field_VariableSize_,
}

// Array fields
// Array element types
// Array field configurations.
// Add constructs for all configurations of type, size, and padding:
//
// - type: u8, u16, enum, struct with static size, struct with dynamic size
// - size: constant, with size field, with count field, unspecified
//
// The type u8 is tested separately since it is likely to be handled
// idiomatically by the specific language generators.

// Array with scalar elements.
struct Struct_Array_Field_ScalarElement_ {
    array: 16[4],
struct Struct_Array_Field_ByteElement_ConstantSize_ {
    array: 8[4],
}
packet Struct_Array_Field_ScalarElement {
    s: Struct_Array_Field_ScalarElement_,
packet Struct_Array_Field_ByteElement_ConstantSize {
    s: Struct_Array_Field_ByteElement_ConstantSize_,
}

// Array with enum elements.
struct Struct_Array_Field_EnumElement_ {
    array: Enum16[4],
struct Struct_Array_Field_ByteElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 8[],
}
packet Struct_Array_Field_EnumElement {
    s: Struct_Array_Field_EnumElement_,
packet Struct_Array_Field_ByteElement_VariableSize {
    s: Struct_Array_Field_ByteElement_VariableSize_,
}

// Array with sized structure elements.
struct Struct_Array_Field_SizedStructElement_ {
    array: SizedStruct[4],
struct Struct_Array_Field_ByteElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: 8[],
}
packet Struct_Array_Field_SizedStructElement {
    s: Struct_Array_Field_SizedStructElement_,
packet Struct_Array_Field_ByteElement_VariableCount {
    s: Struct_Array_Field_ByteElement_VariableCount_,
}

// Array with variable sized structure elements.
struct Struct_Array_Field_UnsizedStructElement_ {
    array: UnsizedStruct[4],
struct Struct_Array_Field_ByteElement_UnknownSize_ {
    array: 8[],
}
packet Struct_Array_Field_ByteElement_UnknownSize {
    s: Struct_Array_Field_ByteElement_UnknownSize_,
}

struct Struct_Array_Field_ScalarElement_ConstantSize_ {
    array: 16[4],
}
packet Struct_Array_Field_UnsizedStructElement {
    s: Struct_Array_Field_UnsizedStructElement_,
packet Struct_Array_Field_ScalarElement_ConstantSize {
    s: Struct_Array_Field_ScalarElement_ConstantSize_,
}

// Array configurations
struct Struct_Array_Field_ScalarElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
}
packet Struct_Array_Field_ScalarElement_VariableSize {
    s: Struct_Array_Field_ScalarElement_VariableSize_,
}

// Array with sized elements, and a variable count.
// The parser must extract as many elements as specified by the count from
// the remaining span. The parser should generate a dynamic array size guard.
struct Struct_Array_Field_SizedElement_VariableCount_ {
struct Struct_Array_Field_ScalarElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: 16[],
}
packet Struct_Array_Field_SizedElement_VariableCount {
    s: Struct_Array_Field_SizedElement_VariableCount_,
packet Struct_Array_Field_ScalarElement_VariableCount {
    s: Struct_Array_Field_ScalarElement_VariableCount_,
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
struct Struct_Array_Field_SizedElement_VariableSize_ {
struct Struct_Array_Field_ScalarElement_UnknownSize_ {
    array: 16[],
}
packet Struct_Array_Field_ScalarElement_UnknownSize {
    s: Struct_Array_Field_ScalarElement_UnknownSize_,
}

struct Struct_Array_Field_EnumElement_ConstantSize_ {
    array: Enum16[4],
}
packet Struct_Array_Field_EnumElement_ConstantSize {
    s: Struct_Array_Field_EnumElement_ConstantSize_,
}

struct Struct_Array_Field_EnumElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: 16[],
    array: Enum16[],
}
packet Struct_Array_Field_SizedElement_VariableSize {
    s: Struct_Array_Field_SizedElement_VariableSize_,
packet Struct_Array_Field_EnumElement_VariableSize {
    s: Struct_Array_Field_EnumElement_VariableSize_,
}

struct Struct_Array_Field_EnumElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: Enum16[],
}
packet Struct_Array_Field_EnumElement_VariableCount {
    s: Struct_Array_Field_EnumElement_VariableCount_,
}

struct Struct_Array_Field_EnumElement_UnknownSize_ {
    array: Enum16[],
}
packet Struct_Array_Field_EnumElement_UnknownSize {
    s: Struct_Array_Field_EnumElement_UnknownSize_,
}

// The parser must extract as many elements as specified by the
// static array count. The parser should generate a static array size guard.
struct Struct_Array_Field_SizedElement_ConstantSize_ {
    array: 16[8],
    array: SizedStruct[4],
}
packet Struct_Array_Field_SizedElement_ConstantSize {
    s: Struct_Array_Field_SizedElement_ConstantSize_,
}

// The parser must extract as many elements as specified by the count from
// the remaining span. No size guard possible.
struct Struct_Array_Field_UnsizedElement_VariableCount_ {
struct Struct_Array_Field_SizedElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
    array: SizedStruct[],
}
packet Struct_Array_Field_SizedElement_VariableSize {
    s: Struct_Array_Field_SizedElement_VariableSize_,
}

struct Struct_Array_Field_SizedElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
    array: SizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_VariableCount {
    s: Struct_Array_Field_UnsizedElement_VariableCount_,
packet Struct_Array_Field_SizedElement_VariableCount {
    s: Struct_Array_Field_SizedElement_VariableCount_,
}

struct Struct_Array_Field_SizedElement_UnknownSize_ {
    array: SizedStruct[],
}
packet Struct_Array_Field_SizedElement_UnknownSize {
    s: Struct_Array_Field_SizedElement_UnknownSize_,
}

struct Struct_Array_Field_UnsizedElement_ConstantSize_ {
    array: UnsizedStruct[4],
}
packet Struct_Array_Field_UnsizedElement_ConstantSize {
    s: Struct_Array_Field_UnsizedElement_ConstantSize_,
}

// The parser must extract as many elements as possible from
// the span with the specified size. The parser should generate a
// dynamic array size guard.
struct Struct_Array_Field_UnsizedElement_VariableSize_ {
    _size_(array) : 4,
    _reserved_: 4,
@@ -628,13 +725,20 @@ packet Struct_Array_Field_UnsizedElement_VariableSize {
    s: Struct_Array_Field_UnsizedElement_VariableSize_,
}

// The parser must extract as many elements as specified by the
// static array count. No size guard possible.
struct Struct_Array_Field_UnsizedElement_ConstantSize_ {
    array: UnsizedStruct[8],
struct Struct_Array_Field_UnsizedElement_VariableCount_ {
    _count_(array) : 4,
    _reserved_: 4,
    array: UnsizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_ConstantSize {
    s: Struct_Array_Field_UnsizedElement_ConstantSize_,
packet Struct_Array_Field_UnsizedElement_VariableCount {
    s: Struct_Array_Field_UnsizedElement_VariableCount_,
}

struct Struct_Array_Field_UnsizedElement_UnknownSize_ {
    array: UnsizedStruct[],
}
packet Struct_Array_Field_UnsizedElement_UnknownSize {
    s: Struct_Array_Field_UnsizedElement_UnknownSize_,
}

// The parser must support complex size modifiers on arrays whose size is
+2024 −826

File changed.

Preview size limit exceeded, changes collapsed.