40 absl::optional<CPDF_CMap::CodeRange> range;
43 range = CPDF_CMapParser::GetCodeRange(
"",
"");
44 EXPECT_FALSE(range.has_value());
45 range = CPDF_CMapParser::GetCodeRange(
"A",
"");
46 EXPECT_FALSE(range.has_value());
49 range = CPDF_CMapParser::GetCodeRange(
"<aaaaaaaaaa>",
"");
50 EXPECT_FALSE(range.has_value());
52 range = CPDF_CMapParser::GetCodeRange(
"<12345678>",
"<87654321>");
53 ASSERT_TRUE(range.has_value());
54 ASSERT_EQ(4u, range.value().m_CharSize);
56 constexpr uint8_t kLower[4] = {18, 52, 86, 120};
57 constexpr uint8_t kUpper[4] = {135, 101, 67, 33};
58 EXPECT_TRUE(uint_ranges_equal(kLower, range.value().m_Lower, 4));
59 EXPECT_TRUE(uint_ranges_equal(kUpper, range.value().m_Upper, 4));
63 range = CPDF_CMapParser::GetCodeRange(
"<a1>",
"<F3>");
64 ASSERT_TRUE(range.has_value());
65 ASSERT_EQ(1u, range.value().m_CharSize);
66 EXPECT_EQ(161, range.value().m_Lower[0]);
67 EXPECT_EQ(243, range.value().m_Upper[0]);
70 range = CPDF_CMapParser::GetCodeRange(
"<a1>",
"");
71 ASSERT_TRUE(range.has_value());
72 ASSERT_EQ(1u, range.value().m_CharSize);
73 EXPECT_EQ(161, range.value().m_Lower[0]);
74 EXPECT_EQ(0, range.value().m_Upper[0]);