src/net/http/structured_headers_unittest.cc
TEST(StructuredHeaderTest, SH09HighPrecisionFloats) {
  // These values are exactly representable in binary floating point, so no
  // accuracy issues are expected in this test.
  base::Optional<ListOfLists> result =
      ParseListOfLists("1.03125;-1.03125;12345678901234.5;-12345678901234.5");
  ASSERT_TRUE(result.has_value());
  EXPECT_EQ(*result,
            (ListOfLists{{Item(1.03125), Item(-1.03125), Item(12345678901234.5),
                          Item(-12345678901234.5)}}));

  result = ParseListOfLists("123456789012345.0");
  EXPECT_FALSE(result.has_value());

  result = ParseListOfLists("-123456789012345.0");
  EXPECT_FALSE(result.has_value());
}
// In Structured Headers Draft 9, floats can have more than three fractional
// digits, and can be larger than 1e12. This behaviour is exposed in the parser
// for SH09-specific lists, so test it through that interface.
In Structured Headers Draft 9, floats can have more than three fractional
digits, and can be larger than 1e12. This behaviour is exposed in the parser
for SH09-specific lists, so test it through that interface.
In Structured Headers Draft 9 floats can have more than three fractional digits and can be larger than 1e12 . This behaviour is exposed in the parser for SH09 - specific lists so test it through that interface .
TEST(StructuredHeaderTest, SH09HighPrecisionFloats) {
  base::Optional<ListOfLists> result =
      ParseListOfLists("1.03125;-1.03125;12345678901234.5;-12345678901234.5");
  ASSERT_TRUE(result.has_value());
  EXPECT_EQ(*result,
            (ListOfLists{{Item(1.03125), Item(-1.03125), Item(12345678901234.5),
                          Item(-12345678901234.5)}}));
  result = ParseListOfLists("123456789012345.0");
  EXPECT_FALSE(result.has_value());
  result = ParseListOfLists("-123456789012345.0");
  EXPECT_FALSE(result.has_value());
}
TEST ( StructuredHeaderTest , SH09HighPrecisionFloats ) { base :: Optional < ListOfLists > result = ParseListOfLists ( " " ) ; ASSERT_TRUE ( result . has_value ( ) ) ; EXPECT_EQ ( * result , ( ListOfLists { { Item ( 1.03125 ) , Item ( -1.03125 ) , Item ( 12345678901234.5 ) , Item ( -12345678901234.5 ) } } ) ) ; result = ParseListOfLists ( " " ) ; EXPECT_FALSE ( result . has_value ( ) ) ; result = ParseListOfLists ( " " ) ; EXPECT_FALSE ( result . has_value ( ) ) ; }
In Structured Headers Draft 9, floats can have more than three fractional
digits, and can be larger than 1e12.
In Structured Headers Draft 9 floats can have more than three fractional digits and can be larger than 1e12 .
// These values are exactly representable in binary floating point, so no // accuracy issues are expected in this test.