blob: a2c2c4f0b2e8976f106d657373caf0881fabc160 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
success("UnionWithBoundString") {
value = UnionWithBoundStringStruct {
v: UnionWithBoundString {
boundFiveStr: "abcd",
},
},
bytes = {
v1 = [
// primary object
num(1):8, // ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
// secondary object 1: union
num(4):8, repeat(0xff):8, // boundFiveStr size, present
// secondary object 2: boundFiveStr
'a', 'b', 'c', 'd', padding:4,
],
v2 = [
// primary object
num(1):8, // ordinal
num(24):4, num(0):2, num(0):2, // envelope
// secondary object 1: union
num(4):8, repeat(0xff):8, // boundFiveStr size, present
// secondary object 2: boundFiveStr
'a', 'b', 'c', 'd', padding:4,
],
},
}
encode_failure("UnionWithBoundString_ExceedsBounds") {
// TODO(fxbug.dev/37304) Enforce size bounds in rust
bindings_denylist = [rust, dart],
value = UnionWithBoundStringStruct {
v: UnionWithBoundString {
boundFiveStr: "abcdef",
},
},
err = STRING_TOO_LONG,
}
success("UnionMigration_SingleVariant") {
value = SingleVariantUnionStruct {
u: SingleVariantUnion {
x: 42,
},
},
bytes = {
v1 = [
// primary object
num(1):8, // ordinal
num(8):4, num(0):4, repeat(0xff):8, // envelope
// secondary object 1: x
num(42):4, padding:4,
],
v2 = [
// primary object
num(1):8, // ordinal
num(42):4, num(0):2, num(1):2, // envelope
],
},
}
success("ReverseOrdinalUnion") {
// TODO(fxbug.dev/72895): Fix C/C++ bindings.
bindings_denylist = [fuzzer_corpus,transformer],
value = ReverseOrdinalUnionStruct {
u: ReverseOrdinalUnion {
x: 42,
},
},
bytes = {
v1 = [
// primary object
num(4):8, // ordinal
num(8):4, num(0):4, repeat(0xff):8, // envelope
// secondary object 1: x
num(42):8,
],
v2 = [
// primary object
num(4):8, // ordinal
num(8):4, num(0):2, num(0):2, // envelope
// secondary object 1: x
num(42):8,
],
},
}
// Regression test for fxbug.dev/72895.
decode_failure("UnionWithInvalidPresenceIndicator") {
// TODO(fxbug.dev/72895): Fix in C/C++ bindings.
bindings_denylist = [c, hlcpp, llcpp],
type = XUnionWithStructStruct,
bytes = {
v1 = [
0xd2, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ordinal
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0x18 bytes, 0 handles
0xd8, 0x09, 0x00, 0x0d, 0xc4, 0x00, 0x00, 0x00, // invalid pointer
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab, 0xab,
0xab, 0xab, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00,
],
// No test for v2 because there no longer is presence indicator.
},
err = INVALID_PRESENCE_INDICATOR,
}
// ======================== UNKNOWN VARIANT TESTS ==========================
success("FlexibleUnionUnknownValue") {
// llcpp is tested by hand since it cannot construct unknown unions (and
// they do not store bytes & handles), see fxr/423117
bindings_denylist = [llcpp,transformer],
value = TestFlexibleXUnionInStruct {
xu: SampleXUnion{
1234: {
// padding must be included in the raw bytes
bytes = [repeat(0xab):20, padding:4],
},
},
},
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
}
success("FlexibleResourceUnionUnknownValue") {
// llcpp is tested by hand since it cannot construct unknown unions (and
// they do not store bytes & handles), see fxr/423117
bindings_denylist = [llcpp,transformer],
value = TestFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion{
1234: {
// padding must be included in the raw bytes
bytes = [repeat(0xab):20, padding:4],
},
},
},
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
}
success("FlexibleResourceUnionUnknownValueWithHandles") {
// llcpp is tested by hand since it cannot construct unknown unions (and
// they do not store bytes & handles), see fxr/423117
bindings_denylist = [llcpp,transformer],
handle_defs = {
#0 = event(),
#1 = event(),
#2 = channel(),
#3 = channel(),
},
value = TestFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {
1234: {
// padding must be included in the raw bytes
bytes = [repeat(0xab):20, padding:4],
handles = [#0, #1, #2, #3],
},
},
},
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
handles = {
v1, v2 = [
#0, #1, #2, #3,
]
}
}
decode_failure("StrictUnionUnknownValue") {
type = TestStrictXUnionInStruct,
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(0):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = STRICT_UNION_UNKNOWN_FIELD,
}
decode_failure("StrictUnionUnknownValueWithHandles") {
handle_defs = {
#0 = event(),
#1 = event(),
#2 = channel(),
#3 = channel(),
},
type = TestStrictXUnionInStruct,
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
handles = {
v1, v2 = [
#0, #1, #2, #3,
]
},
err = STRICT_UNION_UNKNOWN_FIELD,
}
decode_failure("FlexibleUnionUnknownValueWithHandles") {
// C & LLCPP does not store handles, so does not fail when decoding unknown
// handles for a value type.
bindings_denylist = [c, llcpp],
handle_defs = {
#0 = event(),
#1 = event(),
#2 = channel(),
#3 = channel(),
},
type = TestFlexibleXUnionInStruct,
bytes = {
v1 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(1234):8, // unknown ordinal
num(24):4, num(4):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
handles = {
v1, v2 = [
#0, #1, #2, #3,
]
},
err = NON_RESOURCE_UNKNOWN_HANDLES,
}
encode_failure("StrictUnionUnknownValue") {
// Currently no bindings allow constructing a strict union with an unknown variant
bindings_allowlist = [],
value = TestStrictXUnionInStruct {
xu: SampleStrictXUnion{
1234: {
// padding must be included in the raw bytes
bytes = [repeat(0xab):20, padding:4],
}
}
},
err = STRICT_UNION_UNKNOWN_FIELD,
}
decode_failure("FlexibleValueUnionUnknownBytesNonMultipleOf8") {
// TODO(fxbug.dev/80162): Check num_bytes%8==0 in Go.
bindings_denylist = [go],
type = TestFlexibleXUnionInStruct,
bytes = {
v1 = [
num(123):8, // ordinal (unknown)
num(20):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(123):8, // ordinal (unknown)
num(20):4, num(0):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = INVALID_NUM_BYTES_IN_ENVELOPE,
}
decode_failure("FlexibleResourceUnionUnknownBytesNonMultipleOf8") {
// TODO(fxbug.dev/80162): Check num_bytes%8==0 in Go.
bindings_denylist = [go],
type = TestFlexibleResourceXUnionInStruct,
bytes = {
v1 = [
num(123):8, // ordinal (unknown)
num(20):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(123):8, // ordinal (unknown)
num(20):4, num(0):2, num(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = INVALID_NUM_BYTES_IN_ENVELOPE,
}
success("UnionEnvelopeInlining_SmallValue_Inlined") {
value = EnvelopeInliningTestUnionStruct {
u: EnvelopeInliningTestUnion {
small: 100,
},
},
bytes = {
v1 = [
// primary object
num(1):8, // ordinal
num(8):4, num(0):4, repeat(0xff):8, // envelope
// secondary object
num(100):4, padding: 4,
],
v2 = [
// primary object
num(1):8, // ordinal
num(100):4, num(0):2, num(1):2, // inlined envelope
],
},
}
success("UnionEnvelopeInlining_LargeValue_Outlined") {
// TODO(fxbug.dev/80658) Determine why this test is failing in the fuzzer.
bindings_denylist = [fuzzer_corpus],
value = EnvelopeInliningTestUnionStruct {
u: EnvelopeInliningTestUnion {
large: 100,
},
},
bytes = {
v1 = [
// primary object
num(2):8, // ordinal
num(8):4, num(0):4, repeat(0xff):8, // envelope
// secondary object
num(100):8,
],
v2 = [
// primary object
num(2):8, // ordinal
num(8):4, num(0):2, num(0):2, // present
// secondary object
num(100):8,
],
},
}
success("UnionEnvelopeInlining_HandleValue_Inlined") {
handle_defs = {
#0 = event(),
},
value = EnvelopeInliningTestUnionStruct {
u: EnvelopeInliningTestUnion {
handle: #0,
},
},
bytes = {
v1 = [
// primary object
num(3):8, // ordinal
num(8):4, num(1):4, repeat(0xff):8, // envelope
// secondary object
repeat(0xff):4, padding: 4,
],
v2 = [
// primary object
num(3):8, // ordinal
repeat(0xff):4, num(1):2, num(1):2, // inlined envelope
],
},
handles = {
v1, v2 = [#0]
}
}
// Tests decode of a value in a union that can be represented inline in the
// envelope but is incorrectly using the out of line representation.
decode_failure("UnionOutOfLineEnvelopeWhenInlineRequired") {
bindings_allowlist = [go,rust],
type = EnvelopeInliningTestUnionStruct,
bytes = {
v2 = [
// primary object
num(1):8, // ordinal
num(8):4, num(0):2, num(0):2, // present
// secondary object
num(100):8,
],
},
err = INVALID_INLINE_BIT_IN_ENVELOPE,
}
encode_failure("RequiredFlexibleValueUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestFlexibleXUnionInStruct {
xu: SampleXUnion {
0: {
bytes = [],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredFlexibleValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestFlexibleXUnionInStruct {
xu: SampleXUnion {
0: {
bytes = [repeat(0xab):20, padding:4],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredFlexibleResourceUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {
0: {
bytes = [],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredFlexibleResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {
0: {
bytes = [repeat(0xab):20, padding:4],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleValueUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestOptionalFlexibleXUnionInStruct {
xu: SampleXUnion {
0: {
bytes = [],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestOptionalFlexibleXUnionInStruct {
xu: SampleXUnion {
0: {
bytes = [repeat(0xab):20, padding:4],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleResourceUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestOptionalFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {
0: {
bytes = [],
}
}
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go and Dart.
// C and LLCPP cannot construct unknown variants.
bindings_denylist = [go, dart, c, llcpp],
value = TestOptionalFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {
0: {
bytes = [repeat(0xab):20, padding:4],
}
}
},
err = UNION_FIELD_NOT_SET,
}
decode_failure("RequiredStrictValueUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestStrictXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
err = NON_NULLABLE_TYPE_WITH_NULL_VALUE,
}
decode_failure("RequiredStrictValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestStrictXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
decode_failure("RequiredStrictResourceUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestStrictResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
err = NON_NULLABLE_TYPE_WITH_NULL_VALUE,
}
decode_failure("RequiredStrictResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestStrictResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
decode_failure("RequiredFlexibleValueUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestFlexibleXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
err = NON_NULLABLE_TYPE_WITH_NULL_VALUE,
}
decode_failure("RequiredFlexibleValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestFlexibleXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
decode_failure("RequiredFlexibleResourceUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestFlexibleResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
err = NON_NULLABLE_TYPE_WITH_NULL_VALUE,
}
decode_failure("RequiredFlexibleResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestFlexibleResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
success("OptionalStrictValueUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go, transformer],
value = TestOptionalStrictXUnionInStruct {
xu: null,
},
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
}
decode_failure("OptionalStrictValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestOptionalStrictXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
success("OptionalStrictResourceUnionZeroOrdinalNoPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go, transformer],
value = TestOptionalStrictResourceXUnionInStruct {
xu: null,
},
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
}
decode_failure("OptionalStrictResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestOptionalStrictResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
success("OptionalFlexibleValueUnionZeroOrdinalNoPayload") {
value = TestOptionalFlexibleXUnionInStruct {
xu: null,
},
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
}
decode_failure("OptionalFlexibleValueUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestOptionalFlexibleXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
success("OptionalFlexibleResourceUnionZeroOrdinalNoPayload") {
value = TestOptionalFlexibleResourceXUnionInStruct {
xu: null,
},
bytes = {
v1 = [
num(0):8, // zero ordinal
num(0):4, num(0):4, repeat(0x00):8, // envelope
],
v2 = [
num(0):8, // zero ordinal
num(0):4, num(0):2, repeat(0):2, // envelope
],
},
}
decode_failure("OptionalFlexibleResourceUnionZeroOrdinalWithPayload") {
// TODO(fxbug.dev/7805): Fix in Go.
bindings_denylist = [go],
type = TestOptionalFlexibleResourceXUnionInStruct,
bytes = {
v1 = [
num(0):8, // zero ordinal
num(24):4, num(0):4, repeat(0xff):8, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
v2 = [
num(0):8, // zero ordinal
num(24):4, num(0):2, repeat(0):2, // envelope
repeat(0xab):20, padding:4, // unknown bytes
],
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredStrictValueUnionDefaultInitialized") {
bindings_allowlist = [go, hlcpp, llcpp],
value = TestStrictXUnionInStruct {
xu: SampleStrictXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredStrictResourceUnionDefaultInitialized") {
bindings_allowlist = [go, hlcpp, llcpp],
value = TestStrictResourceXUnionInStruct {
xu: SampleStrictResourceXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredFlexibleValueUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in Go.
bindings_allowlist = [hlcpp, llcpp],
value = TestFlexibleXUnionInStruct {
xu: SampleXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("RequiredFlexibleResourceUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in Go.
bindings_allowlist = [hlcpp, llcpp],
value = TestFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalStrictValueUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in HLCPP and LLCPP.
bindings_allowlist = [go],
value = TestOptionalStrictXUnionInStruct {
xu: SampleStrictXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalStrictResourceUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in HLCPP and LLCPP.
bindings_allowlist = [go],
value = TestOptionalStrictResourceXUnionInStruct {
xu: SampleStrictResourceXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleValueUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in HLCPP, LLCPP, and Go.
bindings_allowlist = [],
value = TestOptionalFlexibleXUnionInStruct {
xu: SampleXUnion {},
},
err = UNION_FIELD_NOT_SET,
}
encode_failure("OptionalFlexibleResourceUnionDefaultInitialized") {
// TODO(fxbug.dev/7805): Enable in HLCPP, LLCPP, and Go.
bindings_allowlist = [],
value = TestOptionalFlexibleResourceXUnionInStruct {
xu: SampleResourceXUnion {},
},
err = UNION_FIELD_NOT_SET,
}