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

Side by Side Diff: third_party/libphonenumber/cpp/src/regexp_cache_test.cc

Issue 8736001: Pull the phone library directly. Delete old version. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (C) 2011 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
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
15 // Author: Fredrik Roubert
16
17 #include <cstddef>
18 #include <string>
19
20 #include <gtest/gtest.h>
21
22 #include "regexp_adapter.h"
23 #include "regexp_cache.h"
24
25 namespace i18n {
26 namespace phonenumbers {
27
28 using std::string;
29
30 class RegExpCacheTest : public testing::Test {
31 protected:
32 static const size_t min_items_ = 2;
33
34 RegExpCacheTest() : cache_(min_items_) {}
35 virtual ~RegExpCacheTest() {}
36
37 RegExpCache cache_;
38 };
39
40 TEST_F(RegExpCacheTest, CacheConstructor) {
41 ASSERT_TRUE(cache_.cache_impl_ != NULL);
42 EXPECT_TRUE(cache_.cache_impl_->empty());
43 }
44
45 TEST_F(RegExpCacheTest, GetRegExp) {
46 static const string pattern1("foo");
47 static const string pattern2("foo");
48
49 const RegExp& regexp1 = cache_.GetRegExp(pattern1);
50 // "foo" has been cached therefore we must get the same object.
51 const RegExp& regexp2 = cache_.GetRegExp(pattern2);
52
53 EXPECT_TRUE(&regexp1 == &regexp2);
54 }
55
56 } // namespace phonenumbers
57 } // namespace i18n
OLDNEW
« no previous file with comments | « third_party/libphonenumber/cpp/src/regexp_cache.cc ('k') | third_party/libphonenumber/cpp/src/region_code.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698