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

Unified Diff: chrome/browser/autocomplete/autocomplete_match_unittest.cc

Issue 10700116: autocomplete: Extract AutocompleteMatch unittest from autocomplete_unittest.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/autocomplete_match_unittest.cc
diff --git a/chrome/browser/autocomplete/autocomplete_match_unittest.cc b/chrome/browser/autocomplete/autocomplete_match_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b8fe4ed61b35c9f25026e51c2e8a72168ed706e8
--- /dev/null
+++ b/chrome/browser/autocomplete/autocomplete_match_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/autocomplete/autocomplete_match.h"
+
+#include "base/basictypes.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(AutocompleteMatchTest, MoreRelevant) {
+ struct RelevantCases {
+ int r1;
+ int r2;
+ bool expected_result;
+ } cases[] = {
+ { 10, 0, true },
+ { 10, -5, true },
+ { -5, 10, false },
+ { 0, 10, false },
+ { -10, -5, false },
+ { -5, -10, true },
+ };
+
+ AutocompleteMatch m1(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
+ AutocompleteMatch m2(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED);
+
+ for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); ++i) {
+ m1.relevance = cases[i].r1;
+ m2.relevance = cases[i].r2;
+ EXPECT_EQ(cases[i].expected_result,
+ AutocompleteMatch::MoreRelevant(m1, m2));
+ }
+}
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698