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

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_array_unittest.cpp

Issue 1986533002: Fix the code that causes warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 5 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
6 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" 6 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h"
7 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 { 70 {
71 // When the position to insert is beyond the upper bound, 71 // When the position to insert is beyond the upper bound,
72 // an element is inserted at that position while other unfilled 72 // an element is inserted at that position while other unfilled
73 // positions have nullptr. 73 // positions have nullptr.
74 int elems[] = {1, 2}; 74 int elems[] = {1, 2};
75 ScopedArray arr(new CPDF_Array); 75 ScopedArray arr(new CPDF_Array);
76 for (size_t i = 0; i < FX_ArraySize(elems); ++i) 76 for (size_t i = 0; i < FX_ArraySize(elems); ++i)
77 arr->InsertAt(i, new CPDF_Number(elems[i])); 77 arr->InsertAt(i, new CPDF_Number(elems[i]));
78 arr->InsertAt(10, new CPDF_Number(10)); 78 arr->InsertAt(10, new CPDF_Number(10));
79 EXPECT_EQ(11, arr->GetCount()); 79 EXPECT_EQ(11u, arr->GetCount());
80 for (size_t i = 0; i < FX_ArraySize(elems); ++i) 80 for (size_t i = 0; i < FX_ArraySize(elems); ++i)
81 EXPECT_EQ(elems[i], arr->GetIntegerAt(i)); 81 EXPECT_EQ(elems[i], arr->GetIntegerAt(i));
82 for (size_t i = FX_ArraySize(elems); i < 10; ++i) 82 for (size_t i = FX_ArraySize(elems); i < 10; ++i)
83 EXPECT_EQ(nullptr, arr->GetObjectAt(i)); 83 EXPECT_EQ(nullptr, arr->GetObjectAt(i));
84 EXPECT_EQ(10, arr->GetIntegerAt(10)); 84 EXPECT_EQ(10, arr->GetIntegerAt(10));
85 } 85 }
86 } 86 }
87 87
88 TEST(cpdf_array, Clone) { 88 TEST(cpdf_array, Clone) {
89 { 89 {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 TEST(cpdf_array, Iterator) { 172 TEST(cpdf_array, Iterator) {
173 int elems[] = {-23, -11, 3, 455, 2345877, 173 int elems[] = {-23, -11, 3, 455, 2345877,
174 0, 7895330, -12564334, 10000, -100000}; 174 0, 7895330, -12564334, 10000, -100000};
175 ScopedArray arr(new CPDF_Array); 175 ScopedArray arr(new CPDF_Array);
176 for (size_t i = 0; i < FX_ArraySize(elems); ++i) 176 for (size_t i = 0; i < FX_ArraySize(elems); ++i)
177 arr->InsertAt(i, new CPDF_Number(elems[i])); 177 arr->InsertAt(i, new CPDF_Number(elems[i]));
178 size_t index = 0; 178 size_t index = 0;
179 for (const auto& it : *arr) 179 for (const auto& it : *arr)
180 EXPECT_EQ(elems[index++], it->AsNumber()->GetInteger()); 180 EXPECT_EQ(elems[index++], it->AsNumber()->GetInteger());
181 } 181 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698