14 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<0001>"), testing::Optional(1u));
15 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<c2>"), testing::Optional(194u));
16 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<A2>"), testing::Optional(162u));
17 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<Af2>"),
18 testing::Optional(2802u));
19 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<FFFFFFFF>"),
20 testing::Optional(4294967295u));
23 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<00\n0\r1>"),
24 testing::Optional(1u));
25 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<c 2>"),
26 testing::Optional(194u));
27 EXPECT_THAT(CPDF_ToUnicodeMap::StringToCode(
"<A2\r\n>"),
28 testing::Optional(162u));
31 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<100000000>").has_value());
32 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<1abcdFFFF>").has_value());
35 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"").has_value());
36 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<>").has_value());
37 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"12").has_value());
38 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<12").has_value());
39 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"12>").has_value());
40 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<1-7>").has_value());
41 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"00AB").has_value());
42 EXPECT_FALSE(CPDF_ToUnicodeMap::StringToCode(
"<00NN>").has_value());
66 static constexpr uint8_t kInput1[] =
67 "beginbfrange<FFFFFFFF><FFFFFFFF>[<0041>]endbfrange";
68 auto stream = pdfium::MakeRetain<CPDF_Stream>();
69 stream->SetData(pdfium::make_span(kInput1));
74 static constexpr uint8_t kInput2[] =
75 "beginbfrange<FFFFFFFF><FFFFFFFF><0042>endbfrange";
76 auto stream = pdfium::MakeRetain<CPDF_Stream>();
77 stream->SetData(pdfium::make_span(kInput2));
82 static constexpr uint8_t kInput3[] =
83 "beginbfrange<FFFFFFFF><FFFFFFFF><00410042>endbfrange";
84 auto stream = pdfium::MakeRetain<CPDF_Stream>();
85 stream->SetData(pdfium::make_span(kInput3));
94 static constexpr uint8_t kInput1[] =
95 "beginbfchar<1><0041><2><0042>endbfchar";
96 auto stream = pdfium::MakeRetain<CPDF_Stream>();
97 stream->SetData(pdfium::make_span(kInput1));
101 EXPECT_EQ(1u, map.GetUnicodeCountByCharcodeForTesting(1u));
102 EXPECT_EQ(1u, map.GetUnicodeCountByCharcodeForTesting(2u));
106 static constexpr uint8_t kInput2[] =
107 "beginbfrange<0><0><0041><0><0><0042>endbfrange";
108 auto stream = pdfium::MakeRetain<CPDF_Stream>();
109 stream->SetData(pdfium::make_span(kInput2));
113 EXPECT_EQ(2u, map.GetUnicodeCountByCharcodeForTesting(0u));
118 static constexpr uint8_t kInput3[] =
119 "beginbfrange<0><0>[<0041>]endbfrange\n"
120 "beginbfchar<0><0041>endbfchar";
121 auto stream = pdfium::MakeRetain<CPDF_Stream>();
122 stream->SetData(pdfium::make_span(kInput3));
125 EXPECT_EQ(1u, map.GetUnicodeCountByCharcodeForTesting(0u));