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

Side by Side Diff: components/query_parser/snippet_unittest.cc

Issue 658993002: Convert ARRAYSIZE_UNSAFE -> arraysize in components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium 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 "components/query_parser/snippet.h" 5 #include "components/query_parser/snippet.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 { "0 0 1 4 0 0 2 1", 1, { 1, 5 } }, 234 { "0 0 1 4 0 0 2 1", 1, { 1, 5 } },
235 { "0 0 4 1 0 0 2 1", 2, { 2, 3, 4, 5 } }, 235 { "0 0 4 1 0 0 2 1", 2, { 2, 3, 4, 5 } },
236 { "0 0 0 1", 1, { 0, 1 } }, 236 { "0 0 0 1", 1, { 0, 1 } },
237 { "0 0 0 1 0 0 0 2", 1, { 0, 2 } }, 237 { "0 0 0 1 0 0 0 2", 1, { 0, 2 } },
238 { "0 0 1 1 0 0 1 2", 1, { 1, 3 } }, 238 { "0 0 1 1 0 0 1 2", 1, { 1, 3 } },
239 { "0 0 1 2 0 0 4 3 0 0 3 1", 1, { 1, 7 } }, 239 { "0 0 1 2 0 0 4 3 0 0 3 1", 1, { 1, 7 } },
240 { "0 0 1 4 0 0 2 5", 1, { 1, 7 } }, 240 { "0 0 1 4 0 0 2 5", 1, { 1, 7 } },
241 { "0 0 1 2 0 0 1 1", 1, { 1, 3 } }, 241 { "0 0 1 2 0 0 1 1", 1, { 1, 3 } },
242 { "0 0 1 1 0 0 5 2 0 0 10 1 0 0 3 10", 2, { 1, 2, 3, 13 } }, 242 { "0 0 1 1 0 0 5 2 0 0 10 1 0 0 3 10", 2, { 1, 2, 3, 13 } },
243 }; 243 };
244 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) { 244 for (size_t i = 0; i < arraysize(data); ++i) {
245 Snippet::MatchPositions matches; 245 Snippet::MatchPositions matches;
246 Snippet::ExtractMatchPositions(data[i].offsets_string, "0", &matches); 246 Snippet::ExtractMatchPositions(data[i].offsets_string, "0", &matches);
247 EXPECT_EQ(data[i].expected_match_count, matches.size()); 247 EXPECT_EQ(data[i].expected_match_count, matches.size());
248 for (size_t j = 0; j < data[i].expected_match_count; ++j) { 248 for (size_t j = 0; j < data[i].expected_match_count; ++j) {
249 EXPECT_EQ(data[i].expected_matches[2 * j], matches[j].first); 249 EXPECT_EQ(data[i].expected_matches[2 * j], matches[j].first);
250 EXPECT_EQ(data[i].expected_matches[2 * j + 1], matches[j].second); 250 EXPECT_EQ(data[i].expected_matches[2 * j + 1], matches[j].second);
251 } 251 }
252 } 252 }
253 } 253 }
254 254
255 } // namespace query_parser 255 } // namespace query_parser
OLDNEW
« no previous file with comments | « components/query_parser/query_parser_unittest.cc ('k') | components/search_engines/template_url_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698