Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2656)

Unified Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp

Issue 1539573003: Convert CPDF_Parser::m_CrossRef to a std::map. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: add comments, separate two constants, rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
index d3187c1ff4984656f2145c046e9355d349106028..3fd8dcf35a600fc1ac533dc6d60e0a08b3f73baa 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_unittest.cpp
@@ -267,7 +267,8 @@ TEST(fpdf_parser_parser, RebuildCrossRefCorrectly) {
ASSERT_TRUE(parser.RebuildCrossRef());
const FX_FILESIZE offsets[] = {0, 15, 61, 154, 296, 374, 450};
const FX_WORD versions[] = {0, 0, 2, 4, 6, 8, 0};
- ASSERT_TRUE(CompareArray(parser.m_CrossRef, offsets, FX_ArraySize(offsets)));
+ for (size_t i = 0; i < FX_ArraySize(offsets); ++i)
+ EXPECT_EQ(offsets[i], parser.m_ObjectInfo[i].pos);
ASSERT_TRUE(
CompareArray(parser.m_ObjVersion, versions, FX_ArraySize(versions)));
}
@@ -301,8 +302,8 @@ TEST(fpdf_parser_parser, LoadCrossRefV4) {
ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
const FX_FILESIZE offsets[] = {0, 17, 81, 0, 331, 409};
const uint8_t types[] = {0, 1, 1, 0, 1, 1};
- ASSERT_TRUE(
- CompareArray(parser.m_CrossRef, offsets, FX_ArraySize(offsets)));
+ for (size_t i = 0; i < FX_ArraySize(offsets); ++i)
+ EXPECT_EQ(offsets[i], parser.m_ObjectInfo[i].pos);
ASSERT_TRUE(CompareArray(parser.m_V5Type, types, FX_ArraySize(types)));
}
{
@@ -326,8 +327,8 @@ TEST(fpdf_parser_parser, LoadCrossRefV4) {
const FX_FILESIZE offsets[] = {0, 0, 0, 25325, 0, 0, 0,
0, 25518, 25635, 0, 0, 25777};
const uint8_t types[] = {0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1};
- ASSERT_TRUE(
- CompareArray(parser.m_CrossRef, offsets, FX_ArraySize(offsets)));
+ for (size_t i = 0; i < FX_ArraySize(offsets); ++i)
+ EXPECT_EQ(offsets[i], parser.m_ObjectInfo[i].pos);
ASSERT_TRUE(CompareArray(parser.m_V5Type, types, FX_ArraySize(types)));
}
{
@@ -351,8 +352,8 @@ TEST(fpdf_parser_parser, LoadCrossRefV4) {
const FX_FILESIZE offsets[] = {0, 0, 0, 25325, 0, 0, 0,
0, 0, 25635, 0, 0, 25777};
const uint8_t types[] = {0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1};
- ASSERT_TRUE(
- CompareArray(parser.m_CrossRef, offsets, FX_ArraySize(offsets)));
+ for (size_t i = 0; i < FX_ArraySize(offsets); ++i)
+ EXPECT_EQ(offsets[i], parser.m_ObjectInfo[i].pos);
ASSERT_TRUE(CompareArray(parser.m_V5Type, types, FX_ArraySize(types)));
}
{
@@ -374,8 +375,8 @@ TEST(fpdf_parser_parser, LoadCrossRefV4) {
ASSERT_TRUE(parser.LoadCrossRefV4(0, 0, FALSE));
const FX_FILESIZE offsets[] = {0, 23, 0, 0, 0, 45, 179};
const uint8_t types[] = {0, 1, 0, 0, 0, 1, 1};
- ASSERT_TRUE(
- CompareArray(parser.m_CrossRef, offsets, FX_ArraySize(offsets)));
+ for (size_t i = 0; i < FX_ArraySize(offsets); ++i)
+ EXPECT_EQ(offsets[i], parser.m_ObjectInfo[i].pos);
ASSERT_TRUE(CompareArray(parser.m_V5Type, types, FX_ArraySize(types)));
}
}
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698