Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
The Variant encoding uses different sizes for offsets in nested types to optimize the encoding size
Specifically
- Objects use between 1-4 bytes for the field id depending on the number of fields
- Objects use between 1-4 bytes for the field offset depending on the size of the children
Describe the solution you'd like
I would like tests that use the VariantBuilder
API and cover the following cases:
-
VariantObject
with between 2^8 and 2^16 elements (field_id_size_minus_1
= 1, 2 byte field ids) -
VariantObject
with between 2^16 and 2^24 elements (field_id_size_minus_1
= 2, 3 byte field ids) -
VariantObject
with between 2^24 and 2^32 elements (field_id_size_minus_1
= 3, 4 byte field ids) -
VariantObject
with total child data length between 2^8 and 2^16 elements (field_offset_size_minus_1
= 1, 2 byte field offsets) -
VariantObject
with total child data length between 2^16 and 2^24 elements (field_offset_size_minus_1
= 2, 3 byte field offsets) -
VariantObject
with total child data length between 2^24 and 2^32 elements (field_offset_size_minus_1
= 3, 4 byte field offsets)
The "total child data length" can be made by adding some large strings as children (for example, by adding 1KB - 1MB Varaint::String
s via ArrayBuilder::append
)
Describe alternatives you've considered
Additional context
The tests may not pass until this ticket is implemented:
If they dont' pass, we can mark them #[ignored]
until it is