Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
gtest.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
19 
20 #ifndef PAGESPEED_KERNEL_BASE_GTEST_H_
21 #define PAGESPEED_KERNEL_BASE_GTEST_H_
22 
25 #include "testing/gtest/include/gtest/gtest.h"
26 
27 namespace net_instaweb {
28 
29 GoogleString GTestSrcDir();
30 GoogleString GTestTempDir();
31 
32 }
33 
34 namespace testing {
35 namespace internal {
36 
38 inline GTEST_API_ AssertionResult CmpHelperSTREQ(
39  const char* expected_expression,
40  const char* actual_expression,
41  const StringPiece& expected,
42  const StringPiece& actual) {
43  return CmpHelperSTREQ(expected_expression, actual_expression,
44  expected.as_string().c_str(),
45  actual.as_string().c_str());
46 }
47 
49 inline GTEST_API_ AssertionResult CmpHelperSTRNE(
50  const char* expected_expression,
51  const char* actual_expression,
52  const StringPiece& expected,
53  const StringPiece& actual) {
54  return CmpHelperSTRNE(expected_expression, actual_expression,
55  expected.as_string().c_str(),
56  actual.as_string().c_str());
57 }
58 
61 #define EXPECT_HAS_SUBSTR(needle, haystack) \
62  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSUBSTR, needle, haystack)
63 
64 #define EXPECT_HAS_SUBSTR_NE(needle, haystack) \
65  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSUBSTRNE, needle, haystack)
66 
67 template <typename StringType>
68 inline GTEST_API_ AssertionResult CmpHelperSUBSTR(
69  const char* haystack_expression,
70  const char* needle_expression,
71  const StringType haystack,
72  const StringPiece& needle) {
73  return ::testing::IsSubstring(haystack_expression, needle_expression,
74  haystack, needle.as_string());
75 }
76 
77 template <typename StringType1, typename StringType2>
78 inline GTEST_API_ AssertionResult CmpHelperSUBSTR(
79  const char* haystack_expression,
80  const char* needle_expression,
81  const StringType1 haystack,
82  const StringType2 needle) {
83  return ::testing::IsSubstring(haystack_expression, needle_expression,
84  haystack, needle);
85 }
86 
87 template <typename StringType>
88 inline GTEST_API_ AssertionResult CmpHelperSUBSTRNE(
89  const char* haystack_expression,
90  const char* needle_expression,
91  const StringType haystack,
92  const StringPiece& needle) {
93  return ::testing::IsNotSubstring(haystack_expression, needle_expression,
94  haystack, needle.as_string());
95 }
96 
97 template <typename StringType1, typename StringType2>
98 inline GTEST_API_ AssertionResult CmpHelperSUBSTRNE(
99  const char* haystack_expression,
100  const char* needle_expression,
101  const StringType1 haystack,
102  const StringType2 needle) {
103  return ::testing::IsNotSubstring(haystack_expression, needle_expression,
104  haystack, needle);
105 }
106 
107 }
108 }
109 
110 #endif
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24