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

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

Issue 6920006: Revert 84000 - Autofill phone number enhancements and integration of Phone Number Util Library: p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | 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 <roubert@google.com>
16
17 #include <cstddef>
18 #include <string>
19
20 #include <gtest/gtest.h>
21 #include <re2/re2.h>
22
23 #include "re2_cache.h"
24
25 namespace i18n {
26 namespace phonenumbers {
27
28 using std::string;
29
30 class RE2CacheTest : public testing::Test {
31 protected:
32 static const size_t min_items_ = 2;
33
34 RE2CacheTest() : cache_(min_items_) {}
35 virtual ~RE2CacheTest() {}
36
37 RE2Cache cache_;
38 };
39
40 TEST_F(RE2CacheTest, CacheConstructor) {
41 ASSERT_TRUE(cache_.cache_impl_ != NULL);
42 EXPECT_TRUE(cache_.cache_impl_->empty());
43 }
44
45 TEST_F(RE2CacheTest, AccessConstructor) {
46 static const string foo("foo");
47 RE2Cache::ScopedAccess access(&cache_, foo);
48
49 EXPECT_TRUE(access.regexp_ != NULL);
50 ASSERT_TRUE(cache_.cache_impl_ != NULL);
51 EXPECT_EQ(1, cache_.cache_impl_->size());
52 }
53
54 TEST_F(RE2CacheTest, OperatorRE2) {
55 static const string foo("foo");
56 RE2Cache::ScopedAccess access(&cache_, foo);
57
58 const RE2& regexp = access;
59 EXPECT_EQ(foo, regexp.pattern());
60 }
61
62 } // namespace phonenumbers
63 } // namespace i18n
OLDNEW
« no previous file with comments | « third_party/libphonenumber/cpp/src/re2_cache.cc ('k') | third_party/libphonenumber/cpp/src/regexp_adapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698