src/lib/fidl/llcpp/tests/manual_conformance_test.cc
// The xunion ordinal hashing algorithm generates 32 bit values. But if it did
// generate values bigger than that, they would decode successfully
The xunion ordinal hashing algorithm generates 32 bit values. But if it did
generate values bigger than that, they would decode successfully
The xunion ordinal hashing algorithm generates 32 bit values . But if it did generate values bigger than that they would decode successfully
TEST(InlineXUnionInStruct, SuccessLargeXUnionOrdinal) {
  auto encoded_bytes = std::vector<uint8_t>{
      0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  
      0x53, 0x76, 0x31, 0x6f, 0xaa, 0xaa, 0xaa, 0xaa,  
      0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  
      0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,  
      'b', 'e', 'f', 'o', 'r', 'e',                    
      0x00, 0x00,                                      
      0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
      0xef, 0xbe, 0xad, 0xde, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      'a', 'f', 't', 'e', 'r',                         
      0x00, 0x00, 0x00,                                
  };
  fidl::EncodedMessage<llcpp_misc::InlineXUnionInStruct> encoded_msg(
      fidl::BytePart(&encoded_bytes[0], static_cast<uint32_t>(encoded_bytes.size()),
                     static_cast<uint32_t>(encoded_bytes.size())));
  auto decode_result = fidl::Decode(std::move(encoded_msg));
  ASSERT_EQ(decode_result.status, ZX_OK);
}
TEST ( InlineXUnionInStruct , SuccessLargeXUnionOrdinal ) { auto encoded_bytes = std :: vector < uint8_t > { 0x06 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0x53 , 0x76 , 0x31 , 0x6f , 0xaa , 0xaa , 0xaa , 0xaa , 0x18 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , 0xff , ' ' , ' ' , ' ' , ' ' , ' ' , ' ' , 0x00 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0xef , 0xbe , 0xad , 0xde , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , ' ' , ' ' , ' ' , ' ' , ' ' , 0x00 , 0x00 , 0x00 , } ; fidl :: EncodedMessage < llcpp_misc :: InlineXUnionInStruct > encoded_msg ( fidl :: BytePart ( & encoded_bytes [ 0 ] , static_cast < uint32_t > ( encoded_bytes . size ( ) ) , static_cast < uint32_t > ( encoded_bytes . size ( ) ) ) ) ; auto decode_result = fidl :: Decode ( std :: move ( encoded_msg ) ) ; ASSERT_EQ ( decode_result . status , ZX_OK ) ; }
The xunion ordinal hashing algorithm generates 32 bit values.
The xunion ordinal hashing algorithm generates 32 bit values .
// clang-format off // length of "before" // "before" is present // xunion header // num bytes; num handles // envelope data present // length of "after" // "after" is present // "before" string // 2 bytes of padding // envelope content // "after" string // 3 bytes of padding // clang-format on