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

Side by Side Diff: third_party/libaddressinput/chromium/trie_unittest.cc

Issue 298863012: Use upstream libaddressinput in Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged in https://codereview.chromium.org/300303002/ Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (C) 2014 Google Inc. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // 2 // Use of this source code is governed by a BSD-style license that can be
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // found in the LICENSE file.
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 4
15 #include "util/trie.h" 5 #include "third_party/libaddressinput/chromium/trie.h"
16 6
17 #include <set> 7 #include <set>
18 #include <string> 8 #include <string>
19 9
20 #include <gtest/gtest.h> 10 #include "testing/gtest/include/gtest/gtest.h"
21 11
22 namespace i18n { 12 namespace autofill {
23 namespace addressinput {
24
25 namespace {
26 13
27 TEST(TrieTest, EmptyTrieHasNoData) { 14 TEST(TrieTest, EmptyTrieHasNoData) {
28 Trie<std::string> trie; 15 Trie<std::string> trie;
29 std::set<std::string> result; 16 std::set<std::string> result;
30 trie.FindDataForKeyPrefix("key", &result); 17 trie.FindDataForKeyPrefix("key", &result);
31 EXPECT_TRUE(result.empty()); 18 EXPECT_TRUE(result.empty());
32 } 19 }
33 20
34 TEST(TrieTest, CanGetDataByExactKey) { 21 TEST(TrieTest, CanGetDataByExactKey) {
35 Trie<std::string> trie; 22 Trie<std::string> trie;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 Trie<std::string> trie; 88 Trie<std::string> trie;
102 static const char kVeryLongKey[] = "1234567890qwertyuioasdfghj"; 89 static const char kVeryLongKey[] = "1234567890qwertyuioasdfghj";
103 trie.AddDataForKey(kVeryLongKey, "world"); 90 trie.AddDataForKey(kVeryLongKey, "world");
104 std::set<std::string> result; 91 std::set<std::string> result;
105 trie.FindDataForKeyPrefix(kVeryLongKey, &result); 92 trie.FindDataForKeyPrefix(kVeryLongKey, &result);
106 std::set<std::string> expected; 93 std::set<std::string> expected;
107 expected.insert("world"); 94 expected.insert("world");
108 EXPECT_EQ(expected, result); 95 EXPECT_EQ(expected, result);
109 } 96 }
110 97
111 } // namespace 98 } // namespace autofill
112
113 } // namespace addressinput
114 } // namespace i18n
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698