├── .github
├── FUNDING.yml
└── workflows
│ └── ci-mac.yaml
├── .gitignore
├── .gitmodules
├── CODE_OF_CONDUCT.md
├── GoogleMock.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ └── GoogleMock.xcscheme
├── GoogleMock
├── Classes
│ └── GMXCTestBridge.mm
├── GoogleMock-Info.plist
├── GoogleMock.h
├── gmock-Info.plist
└── gtest-Info.plist
├── GoogleMockTests
├── Info.plist
└── Test.cpp
├── LICENSE
├── Libraries
├── Makefile
├── build
│ ├── include
│ │ ├── gmock
│ │ │ ├── gmock-actions.h
│ │ │ ├── gmock-cardinalities.h
│ │ │ ├── gmock-generated-actions.h
│ │ │ ├── gmock-generated-actions.h.pump
│ │ │ ├── gmock-generated-function-mockers.h
│ │ │ ├── gmock-generated-function-mockers.h.pump
│ │ │ ├── gmock-generated-matchers.h
│ │ │ ├── gmock-generated-matchers.h.pump
│ │ │ ├── gmock-generated-nice-strict.h
│ │ │ ├── gmock-generated-nice-strict.h.pump
│ │ │ ├── gmock-matchers.h
│ │ │ ├── gmock-more-actions.h
│ │ │ ├── gmock-more-matchers.h
│ │ │ ├── gmock-spec-builders.h
│ │ │ ├── gmock.h
│ │ │ └── internal
│ │ │ │ ├── custom
│ │ │ │ ├── gmock-generated-actions.h
│ │ │ │ ├── gmock-generated-actions.h.pump
│ │ │ │ ├── gmock-matchers.h
│ │ │ │ └── gmock-port.h
│ │ │ │ ├── gmock-generated-internal-utils.h
│ │ │ │ ├── gmock-generated-internal-utils.h.pump
│ │ │ │ ├── gmock-internal-utils.h
│ │ │ │ └── gmock-port.h
│ │ └── gtest
│ │ │ ├── gtest-death-test.h
│ │ │ ├── gtest-message.h
│ │ │ ├── gtest-param-test.h
│ │ │ ├── gtest-param-test.h.pump
│ │ │ ├── gtest-printers.h
│ │ │ ├── gtest-spi.h
│ │ │ ├── gtest-test-part.h
│ │ │ ├── gtest-typed-test.h
│ │ │ ├── gtest.h
│ │ │ ├── gtest_pred_impl.h
│ │ │ ├── gtest_prod.h
│ │ │ └── internal
│ │ │ ├── custom
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-printers.h
│ │ │ └── gtest.h
│ │ │ ├── gtest-death-test-internal.h
│ │ │ ├── gtest-filepath.h
│ │ │ ├── gtest-internal.h
│ │ │ ├── gtest-linked_ptr.h
│ │ │ ├── gtest-param-util-generated.h
│ │ │ ├── gtest-param-util-generated.h.pump
│ │ │ ├── gtest-param-util.h
│ │ │ ├── gtest-port-arch.h
│ │ │ ├── gtest-port.h
│ │ │ ├── gtest-string.h
│ │ │ ├── gtest-tuple.h
│ │ │ ├── gtest-tuple.h.pump
│ │ │ ├── gtest-type-util.h
│ │ │ └── gtest-type-util.h.pump
│ └── lib
│ │ ├── linux
│ │ ├── libgmock.a
│ │ ├── libgmock_main.a
│ │ ├── libgtest.a
│ │ └── libgtest_main.a
│ │ └── osx
│ │ ├── libgmock.a
│ │ ├── libgmock_main.a
│ │ ├── libgtest.a
│ │ └── libgtest_main.a
└── tmp
│ ├── .gitignore
│ └── build
│ └── .gitignore
└── README.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: macmade
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci-mac.yaml:
--------------------------------------------------------------------------------
1 | name: ci-mac
2 | on: [push]
3 | jobs:
4 | ci:
5 | runs-on: macos-latest
6 | strategy:
7 | matrix:
8 | run-config:
9 | - { scheme: 'GoogleMock', configuration: 'Debug', project: 'GoogleMock.xcodeproj', build: 1, analyze: 1, test: 1, info: 1, destination: 'platform=macOS' }
10 | - { scheme: 'GoogleMock', configuration: 'Release', project: 'GoogleMock.xcodeproj', build: 1, analyze: 1, test: 0, info: 1, destination: 'platform=macOS' }
11 | steps:
12 |
13 | - uses: actions/checkout@v1
14 | with:
15 | submodules: 'recursive'
16 |
17 | - uses: macmade/action-xcodebuild@v1.0.0
18 |
19 | - uses: macmade/action-slack@v1.0.0
20 | if: ${{ always() }}
21 | env:
22 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
23 | with:
24 | channel: '#ci'
25 | status: ${{ job.status }}
26 | title: ${{ matrix.run-config[ 'scheme' ] }} - ${{ matrix.run-config[ 'configuration' ] }}
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac Finder
2 | .DS_Store
3 | .Trashes
4 | Icon?
5 |
6 | # Thumbnails
7 | ._*
8 |
9 | # Files that might appear on external disk
10 | .Spotlight-V100
11 | .Trashes
12 |
13 | # Xcode
14 | *.pbxuser
15 | *.mode1v3
16 | *.mode2v3
17 | *.perspectivev3
18 | *.xccheckout
19 | !default.pbxuser
20 | !default.mode1v3
21 | !default.mode2v3
22 | !default.perspectivev3
23 | xcuserdata
24 | default.profraw
25 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Submodules/xcconfig"]
2 | path = Submodules/xcconfig
3 | url = https://github.com/macmade/xcconfig.git
4 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | xs-labs.com.
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/GoogleMock.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GoogleMock.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GoogleMock.xcodeproj/xcshareddata/xcschemes/GoogleMock.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
47 |
48 |
54 |
55 |
56 |
57 |
59 |
65 |
66 |
67 |
68 |
69 |
85 |
86 |
92 |
93 |
94 |
95 |
101 |
102 |
108 |
109 |
110 |
111 |
113 |
114 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/GoogleMock/Classes/GMXCTestBridge.mm:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Jean-David Gadina - www.xs-labs.com / www.digidna.net
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | ******************************************************************************/
24 |
25 | /*!
26 | * @file GMXCTestBridge.mm
27 | * @copyright (c) 2015 - Jean-David Gadina - www.xs-labs.com
28 | * @abstract GoogleMock XCTest bridge
29 | */
30 |
31 | #ifdef __clang__
32 | #pragma clang diagnostic push
33 | #pragma clang diagnostic ignored "-Wvariadic-macros"
34 | #pragma clang diagnostic ignored "-Wgnu-statement-expression"
35 | #pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
36 | #if __clang_major__ > 8
37 | #pragma clang diagnostic ignored "-Wunguarded-availability"
38 | #endif
39 | #endif
40 |
41 | #import
42 | #import
43 | #import
44 |
45 | using namespace testing;
46 |
47 | static bool __inited = false;
48 | static std::vector< const TestCase * > * __t = nullptr;
49 |
50 | static void __f( id self, SEL _cmd );
51 | static void __f( id self, SEL _cmd )
52 | {
53 | std::string testCaseName;
54 | std::string testInfoName;
55 | int i;
56 | int n;
57 | const TestInfo * testInfo;
58 | const TestResult * testResult;
59 |
60 | /* Name of the GMock test case to analyze */
61 | testCaseName = std::string( [ NSStringFromClass( [ self class ] ) UTF8String ] );
62 |
63 | /* Name of the GMock test to analyze */
64 | testInfoName = std::string( [ [ NSStringFromSelector( _cmd ) substringFromIndex: 4 ] UTF8String ] );
65 |
66 | /* Process each stored GMock test case */
67 | for( const TestCase * testCase: *( __t ) )
68 | {
69 | if( std::string( testCase->name() ) != testCaseName )
70 | {
71 | /* Not the current test case */
72 | continue;
73 | }
74 |
75 | /* Number of tests in the test case */
76 | n = testCase->total_test_count();
77 |
78 | /* Process each test in the test case */
79 | for( i = 0; i < n; i++ )
80 | {
81 | testInfo = testCase->GetTestInfo( i );
82 |
83 | if( testInfo == nullptr )
84 | {
85 | continue;
86 | }
87 |
88 | if( std::string( testInfo->name() ) != testInfoName )
89 | {
90 | /* Not the current test */
91 | continue;
92 | }
93 |
94 | if( testInfo->should_run() == false )
95 | {
96 | /* Test is disabled */
97 | return;
98 | }
99 |
100 | testResult = testInfo->result();
101 |
102 | if( testResult == nullptr )
103 | {
104 | XCTAssertNotEqual( testResult, nullptr, "Invalid GMock test result" );
105 |
106 | return;
107 | }
108 |
109 | if( testResult->Passed() )
110 | {
111 | /* Test has passed */
112 | XCTAssertTrue( true );
113 |
114 | return;
115 | }
116 |
117 | /* Test has failed */
118 | {
119 | int testPartResultCount;
120 | int j;
121 | NSString * message;
122 | NSString * part;
123 | NSMutableArray * parts;
124 | NSString * file;
125 | NSUInteger line;
126 |
127 | /* Number of test part results */
128 | testPartResultCount = testResult->total_part_count();
129 |
130 | /* Process each test part result */
131 | for( j = 0; j < testPartResultCount; j++ )
132 | {
133 | const TestPartResult & testPartResult = testResult->GetTestPartResult( j );
134 |
135 | if( testPartResult.type() != TestPartResult::kFatalFailure )
136 | {
137 | /* Successfull part */
138 | continue;
139 | }
140 |
141 | /* Test message */
142 | message = [ NSString stringWithCString: testPartResult.message() encoding: NSUTF8StringEncoding ];
143 | parts = [ NSMutableArray new ];
144 |
145 | for( part in [ message componentsSeparatedByString: @"\n" ] )
146 | {
147 | [ parts addObject: [ part stringByTrimmingCharactersInSet: [ NSCharacterSet whitespaceCharacterSet ] ] ];
148 | }
149 |
150 | message = [ parts componentsJoinedByString: @" | " ];
151 |
152 | /* Test file and line */
153 | if( testPartResult.file_name() == nullptr )
154 | {
155 | file = @"";
156 | line = 0;
157 | }
158 | else
159 | {
160 | file = [ NSString stringWithCString: testPartResult.file_name() encoding: NSUTF8StringEncoding ];
161 | line = ( NSUInteger )( testPartResult.line_number() );
162 | }
163 |
164 | /* Fails the test */
165 | [ self recordFailureWithDescription: message inFile: file atLine: line expected: YES ];
166 | }
167 | }
168 |
169 | return;
170 | }
171 | }
172 |
173 | XCTAssertTrue( false, "Cannot determine GMock test from current selector" );
174 | }
175 |
176 | static void __dtor( void ) __attribute__( ( destructor ) );
177 | static void __dtor( void )
178 | {
179 | delete __t;
180 | }
181 |
182 | @interface GoogleMockXCTestBridge: XCTestCase
183 | {}
184 |
185 | @end
186 |
187 | @implementation GoogleMockXCTestBridge
188 |
189 | + ( void )initialize
190 | {
191 | if( self != [ GoogleMockXCTestBridge self ] )
192 | {
193 | return;
194 | }
195 |
196 | /* Initializes GMock */
197 | {
198 | int argc;
199 | const char * argv[ 1 ];
200 |
201 | argc = 1;
202 | argv[ 0 ] = "GoogleMockXCTestBridge";
203 |
204 | testing::InitGoogleMock( &argc, const_cast< char ** >( argv ) );
205 | }
206 |
207 | /*
208 | * Support for xctool
209 | *
210 | * The xctool helper will use otest-query-osx to query all tests in
211 | * the bundle, expecting JSON output in stdout.
212 | * As the GMock output is not JSON, we don't run the tests in such a case.
213 | * The Objective-C classes for each GMock test cases will still be
214 | * created, and the tests correctly run when necessary.
215 | */
216 | if( [ [ [ NSProcessInfo processInfo ] processName ] isEqualToString: @"otest-query-osx" ] == NO )
217 | {
218 | /* Runs all GMock tests */
219 | {
220 | int res;
221 |
222 | res = RUN_ALL_TESTS();
223 |
224 | /* warn_unused_result */
225 | ( void )res;
226 | }
227 | }
228 |
229 | /* Stores all GMock test cases and creates XCTest methods for each one */
230 | {
231 | const TestCase * testCase;
232 | const TestInfo * testInfo;
233 | int testCaseCount;
234 | int testInfoCount;
235 | int i;
236 | int j;
237 | Class cls;
238 | IMP imp;
239 | SEL sel;
240 | NSString * testName;
241 |
242 | /* Storage for the GMock test cases */
243 | __t = new std::vector< const TestCase * >;
244 |
245 | /* Number of available GMock test cases */
246 | testCaseCount = UnitTest::GetInstance()->total_test_case_count();
247 |
248 | /* Process each test case */
249 | for( i = 0; i < testCaseCount; i++ )
250 | {
251 | testCase = UnitTest::GetInstance()->GetTestCase( i );
252 |
253 | if( testCase == nullptr )
254 | {
255 | continue;
256 | }
257 |
258 | /* Stores the test case */
259 | __t->push_back( testCase );
260 |
261 | /* Creates a new Objective-C class for the test case */
262 | cls = objc_allocateClassPair( objc_getClass( "XCTestCase" ), testCase->name(), 0 );
263 |
264 | /* Number of tests in the test case */
265 | testInfoCount = testCase->total_test_count();
266 |
267 | /* Process each test in the test case */
268 | for( j = 0; j < testInfoCount; j++ )
269 | {
270 | testInfo = testCase->GetTestInfo( j );
271 |
272 | if( testInfo == nullptr )
273 | {
274 | continue;
275 | }
276 |
277 | /* XCTest method name and selector */
278 | testName = [ NSString stringWithFormat: @"test%s", testInfo->name() ];
279 | sel = sel_registerName( testName.UTF8String );
280 |
281 | /* IMP for the generic XCTest method */
282 | imp = reinterpret_cast< IMP >( __f );
283 |
284 | /* Adds the XCTest method to the class, so Xcode will run it */
285 | class_addMethod( cls, sel, imp, "v@:" );
286 |
287 | /* We have tests from GMock */
288 | __inited = true;
289 | }
290 |
291 | /* Registers the new class with the Objective-C runtime */
292 | objc_registerClassPair( cls );
293 | }
294 | }
295 | }
296 |
297 | - ( void )testHasGoogleMockTests
298 | {
299 | XCTAssertTrue( __inited, "No GMock test" );
300 | }
301 |
302 | @end
303 |
--------------------------------------------------------------------------------
/GoogleMock/GoogleMock-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2015 XS-Labs. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/GoogleMock/GoogleMock.h:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Jean-David Gadina - www.xs-labs.com / www.digidna.net
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | ******************************************************************************/
24 |
25 | /*!
26 | * @header GoogleMock.h
27 | * @copyright (c) 2015 - Jean-David Gadina - www.xs-labs.com
28 | * @abstract GoogleMock integration for Xcode (XCTest)
29 | */
30 |
31 | #ifndef GOOGLE_MOCK_H
32 | #define GOOGLE_MOCK_H
33 |
34 | /* GoogleMock C++ include files */
35 | #ifdef __cplusplus
36 |
37 | #ifdef __clang__
38 | #pragma clang diagnostic push
39 | #pragma clang diagnostic ignored "-Wc99-extensions"
40 | #pragma clang diagnostic ignored "-Wvariadic-macros"
41 | #pragma clang diagnostic ignored "-Wc++11-long-long"
42 | #pragma clang diagnostic ignored "-Wc++11-extensions"
43 | #pragma clang diagnostic ignored "-Wreserved-id-macro"
44 | #pragma clang diagnostic ignored "-Wmissing-noreturn"
45 | #pragma clang diagnostic ignored "-Wpadded"
46 | #pragma clang diagnostic ignored "-Wused-but-marked-unused"
47 | #pragma clang diagnostic ignored "-Wdeprecated"
48 | #pragma clang diagnostic ignored "-Wglobal-constructors"
49 | #endif
50 |
51 | #include
52 | #include
53 |
54 | #ifdef __clang__
55 | #pragma clang diagnostic pop
56 | #endif
57 |
58 | #ifdef __clang__
59 | #pragma clang diagnostic push
60 | #pragma clang diagnostic ignored "-Wglobal-constructors"
61 | #endif
62 |
63 | #endif /* __cplusplus */
64 |
65 | #endif /* GOOGLE_MOCK_H */
66 |
--------------------------------------------------------------------------------
/GoogleMock/gmock-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2015 XS-Labs. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/GoogleMock/gtest-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSHumanReadableCopyright
24 | Copyright © 2015 XS-Labs. All rights reserved.
25 | NSPrincipalClass
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/GoogleMockTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/GoogleMockTests/Test.cpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2014 Jean-David Gadina - www.xs-labs.com / www.digidna.net
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in
14 | * all copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | * THE SOFTWARE.
23 | ******************************************************************************/
24 |
25 | /*!
26 | * @file Test.cpp
27 | * @copyright (c) 2015 - Jean-David Gadina - www.xs-labs.com
28 | * @abstract Example test file
29 | */
30 |
31 | #include
32 |
33 | using namespace testing;
34 |
35 | TEST( GMockXcode, ExampleTest )
36 | {
37 | ASSERT_TRUE( true );
38 | }
39 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Jean-David Gadina - www.xs-labs.com / www.digidna.net
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Libraries/Makefile:
--------------------------------------------------------------------------------
1 | #-------------------------------------------------------------------------------
2 | # The MIT License (MIT)
3 | #
4 | # Copyright (c) 2014 Jean-David Gadina - www.xs-labs.com / www.digidna.net
5 | #
6 | # Permission is hereby granted, free of charge, to any person obtaining a copy
7 | # of this software and associated documentation files (the "Software"), to deal
8 | # in the Software without restriction, including without limitation the rights
9 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | # copies of the Software, and to permit persons to whom the Software is
11 | # furnished to do so, subject to the following conditions:
12 | #
13 | # The above copyright notice and this permission notice shall be included in
14 | # all copies or substantial portions of the Software.
15 | #
16 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | # THE SOFTWARE.
23 | #-------------------------------------------------------------------------------
24 |
25 | #-------------------------------------------------------------------------------
26 | # @file Makefile
27 | # @copyright (c) 2015 - Jean-David Gadina - www.xs-labs.com
28 | # @abstract GMock makefile for POSIX platforms
29 | #-------------------------------------------------------------------------------
30 |
31 | #-------------------------------------------------------------------------------
32 | # Path to directories
33 | #-------------------------------------------------------------------------------
34 |
35 | DIR_BUILD = ./build/
36 | DIR_TMP = ./tmp/
37 | DIR_TMP_BUILD = $(DIR_TMP)build/
38 |
39 | ifeq ($(findstring Darwin, $(shell uname)),)
40 | DIR_BUILD_LIB = $(DIR_BUILD)lib/linux/
41 | CMAKE_FLAGS =
42 | else
43 | DIR_BUILD_LIB = $(DIR_BUILD)lib/osx/
44 | CMAKE_FLAGS = -DCMAKE_OSX_SYSROOT=$(xcrun --sdk macosx --show-sdk-path) -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 -DCMAKE_CXX_FLAGS="-stdlib=libc++"
45 | endif
46 |
47 | #-------------------------------------------------------------------------------
48 | # Software versions
49 | #-------------------------------------------------------------------------------
50 |
51 | VERSION_GMOCK = 1.8.0
52 |
53 | #-------------------------------------------------------------------------------
54 | # Source paths
55 | #-------------------------------------------------------------------------------
56 |
57 | SRC_GMOCK = $(DIR_TMP)release-$(VERSION_GMOCK).zip
58 | SRC_GMOCK_DIR = $(DIR_TMP)googletest-release-$(VERSION_GMOCK)/
59 |
60 | #-------------------------------------------------------------------------------
61 | # Targets
62 | #-------------------------------------------------------------------------------
63 |
64 | # Phony targets
65 | .PHONY: clean all gmock_unpack gmock_build
66 |
67 | # Complete build
68 | all: $(SRC_GMOCK) gmock_unpack gmock_build
69 |
70 | # Clean-up
71 | clean:
72 | @echo " *** Cleaning all build files"
73 |
74 | # GMock source download
75 | $(SRC_GMOCK):
76 | @echo " *** Downloading GMock ($(VERSION_GMOCK))"
77 | @cd $(DIR_TMP) && curl -O -L https://github.com/google/googletest/archive/release-$(VERSION_GMOCK).zip
78 |
79 | # GMock source un-archiving
80 | gmock_unpack:
81 | @echo " *** Unpacking GMock ($(VERSION_GMOCK))"
82 | @if [ ! -d $(SRC_GMOCK_DIR) ]; then unzip $(SRC_GMOCK) -d $(DIR_TMP); fi
83 |
84 | # GMock libraries build
85 | gmock_build:
86 | @echo " *** Building GMock ($(VERSION_GMOCK))"
87 | @cd $(DIR_TMP_BUILD) && cmake $(CMAKE_FLAGS) ../../$(SRC_GMOCK_DIR) && make
88 | @cp $(DIR_TMP_BUILD)googlemock/libgmock.a $(DIR_BUILD_LIB)
89 | @cp $(DIR_TMP_BUILD)googlemock/libgmock_main.a $(DIR_BUILD_LIB)
90 | @cp $(DIR_TMP_BUILD)googlemock/gtest/libgtest_main.a $(DIR_BUILD_LIB)
91 | @cp $(DIR_TMP_BUILD)googlemock/gtest/libgtest.a $(DIR_BUILD_LIB)
92 | @cp -rf $(SRC_GMOCK_DIR)googlemock/include/gmock $(DIR_BUILD)include/
93 | @cp -rf $(SRC_GMOCK_DIR)googletest/include/gtest $(DIR_BUILD)include/
94 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock-cardinalities.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: wan@google.com (Zhanyong Wan)
31 |
32 | // Google Mock - a framework for writing C++ mock classes.
33 | //
34 | // This file implements some commonly used cardinalities. More
35 | // cardinalities can be defined by the user implementing the
36 | // CardinalityInterface interface if necessary.
37 |
38 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
39 | #define GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
40 |
41 | #include
42 | #include // NOLINT
43 | #include "gmock/internal/gmock-port.h"
44 | #include "gtest/gtest.h"
45 |
46 | namespace testing {
47 |
48 | // To implement a cardinality Foo, define:
49 | // 1. a class FooCardinality that implements the
50 | // CardinalityInterface interface, and
51 | // 2. a factory function that creates a Cardinality object from a
52 | // const FooCardinality*.
53 | //
54 | // The two-level delegation design follows that of Matcher, providing
55 | // consistency for extension developers. It also eases ownership
56 | // management as Cardinality objects can now be copied like plain values.
57 |
58 | // The implementation of a cardinality.
59 | class CardinalityInterface {
60 | public:
61 | virtual ~CardinalityInterface() {}
62 |
63 | // Conservative estimate on the lower/upper bound of the number of
64 | // calls allowed.
65 | virtual int ConservativeLowerBound() const { return 0; }
66 | virtual int ConservativeUpperBound() const { return INT_MAX; }
67 |
68 | // Returns true iff call_count calls will satisfy this cardinality.
69 | virtual bool IsSatisfiedByCallCount(int call_count) const = 0;
70 |
71 | // Returns true iff call_count calls will saturate this cardinality.
72 | virtual bool IsSaturatedByCallCount(int call_count) const = 0;
73 |
74 | // Describes self to an ostream.
75 | virtual void DescribeTo(::std::ostream* os) const = 0;
76 | };
77 |
78 | // A Cardinality is a copyable and IMMUTABLE (except by assignment)
79 | // object that specifies how many times a mock function is expected to
80 | // be called. The implementation of Cardinality is just a linked_ptr
81 | // to const CardinalityInterface, so copying is fairly cheap.
82 | // Don't inherit from Cardinality!
83 | class GTEST_API_ Cardinality {
84 | public:
85 | // Constructs a null cardinality. Needed for storing Cardinality
86 | // objects in STL containers.
87 | Cardinality() {}
88 |
89 | // Constructs a Cardinality from its implementation.
90 | explicit Cardinality(const CardinalityInterface* impl) : impl_(impl) {}
91 |
92 | // Conservative estimate on the lower/upper bound of the number of
93 | // calls allowed.
94 | int ConservativeLowerBound() const { return impl_->ConservativeLowerBound(); }
95 | int ConservativeUpperBound() const { return impl_->ConservativeUpperBound(); }
96 |
97 | // Returns true iff call_count calls will satisfy this cardinality.
98 | bool IsSatisfiedByCallCount(int call_count) const {
99 | return impl_->IsSatisfiedByCallCount(call_count);
100 | }
101 |
102 | // Returns true iff call_count calls will saturate this cardinality.
103 | bool IsSaturatedByCallCount(int call_count) const {
104 | return impl_->IsSaturatedByCallCount(call_count);
105 | }
106 |
107 | // Returns true iff call_count calls will over-saturate this
108 | // cardinality, i.e. exceed the maximum number of allowed calls.
109 | bool IsOverSaturatedByCallCount(int call_count) const {
110 | return impl_->IsSaturatedByCallCount(call_count) &&
111 | !impl_->IsSatisfiedByCallCount(call_count);
112 | }
113 |
114 | // Describes self to an ostream
115 | void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
116 |
117 | // Describes the given actual call count to an ostream.
118 | static void DescribeActualCallCountTo(int actual_call_count,
119 | ::std::ostream* os);
120 |
121 | private:
122 | internal::linked_ptr impl_;
123 | };
124 |
125 | // Creates a cardinality that allows at least n calls.
126 | GTEST_API_ Cardinality AtLeast(int n);
127 |
128 | // Creates a cardinality that allows at most n calls.
129 | GTEST_API_ Cardinality AtMost(int n);
130 |
131 | // Creates a cardinality that allows any number of calls.
132 | GTEST_API_ Cardinality AnyNumber();
133 |
134 | // Creates a cardinality that allows between min and max calls.
135 | GTEST_API_ Cardinality Between(int min, int max);
136 |
137 | // Creates a cardinality that allows exactly n calls.
138 | GTEST_API_ Cardinality Exactly(int n);
139 |
140 | // Creates a cardinality from its implementation.
141 | inline Cardinality MakeCardinality(const CardinalityInterface* c) {
142 | return Cardinality(c);
143 | }
144 |
145 | } // namespace testing
146 |
147 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_CARDINALITIES_H_
148 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock-generated-function-mockers.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $$ This is a Pump source file. Please use Pump to convert it to
3 | $$ gmock-generated-function-mockers.h.
4 | $$
5 | $var n = 10 $$ The maximum arity we support.
6 | // Copyright 2007, Google Inc.
7 | // All rights reserved.
8 | //
9 | // Redistribution and use in source and binary forms, with or without
10 | // modification, are permitted provided that the following conditions are
11 | // met:
12 | //
13 | // * Redistributions of source code must retain the above copyright
14 | // notice, this list of conditions and the following disclaimer.
15 | // * Redistributions in binary form must reproduce the above
16 | // copyright notice, this list of conditions and the following disclaimer
17 | // in the documentation and/or other materials provided with the
18 | // distribution.
19 | // * Neither the name of Google Inc. nor the names of its
20 | // contributors may be used to endorse or promote products derived from
21 | // this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | //
35 | // Author: wan@google.com (Zhanyong Wan)
36 |
37 | // Google Mock - a framework for writing C++ mock classes.
38 | //
39 | // This file implements function mockers of various arities.
40 |
41 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
42 | #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
43 |
44 | #include "gmock/gmock-spec-builders.h"
45 | #include "gmock/internal/gmock-internal-utils.h"
46 |
47 | #if GTEST_HAS_STD_FUNCTION_
48 | # include
49 | #endif
50 |
51 | namespace testing {
52 | namespace internal {
53 |
54 | template
55 | class FunctionMockerBase;
56 |
57 | // Note: class FunctionMocker really belongs to the ::testing
58 | // namespace. However if we define it in ::testing, MSVC will
59 | // complain when classes in ::testing::internal declare it as a
60 | // friend class template. To workaround this compiler bug, we define
61 | // FunctionMocker in ::testing::internal and import it into ::testing.
62 | template
63 | class FunctionMocker;
64 |
65 |
66 | $range i 0..n
67 | $for i [[
68 | $range j 1..i
69 | $var typename_As = [[$for j [[, typename A$j]]]]
70 | $var As = [[$for j, [[A$j]]]]
71 | $var as = [[$for j, [[a$j]]]]
72 | $var Aas = [[$for j, [[A$j a$j]]]]
73 | $var ms = [[$for j, [[m$j]]]]
74 | $var matchers = [[$for j, [[const Matcher& m$j]]]]
75 | template
76 | class FunctionMocker : public
77 | internal::FunctionMockerBase {
78 | public:
79 | typedef R F($As);
80 | typedef typename internal::Function::ArgumentTuple ArgumentTuple;
81 |
82 | MockSpec& With($matchers) {
83 |
84 | $if i >= 1 [[
85 | this->current_spec().SetMatchers(::testing::make_tuple($ms));
86 |
87 | ]]
88 | return this->current_spec();
89 | }
90 |
91 | R Invoke($Aas) {
92 | // Even though gcc and MSVC don't enforce it, 'this->' is required
93 | // by the C++ standard [14.6.4] here, as the base class type is
94 | // dependent on the template argument (and thus shouldn't be
95 | // looked into when resolving InvokeWith).
96 | return this->InvokeWith(ArgumentTuple($as));
97 | }
98 | };
99 |
100 |
101 | ]]
102 | } // namespace internal
103 |
104 | // The style guide prohibits "using" statements in a namespace scope
105 | // inside a header file. However, the FunctionMocker class template
106 | // is meant to be defined in the ::testing namespace. The following
107 | // line is just a trick for working around a bug in MSVC 8.0, which
108 | // cannot handle it if we define FunctionMocker in ::testing.
109 | using internal::FunctionMocker;
110 |
111 | // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
112 | // We define this as a variadic macro in case F contains unprotected
113 | // commas (the same reason that we use variadic macros in other places
114 | // in this file).
115 | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
116 | #define GMOCK_RESULT_(tn, ...) \
117 | tn ::testing::internal::Function<__VA_ARGS__>::Result
118 |
119 | // The type of argument N of the given function type.
120 | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
121 | #define GMOCK_ARG_(tn, N, ...) \
122 | tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
123 |
124 | // The matcher type for argument N of the given function type.
125 | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
126 | #define GMOCK_MATCHER_(tn, N, ...) \
127 | const ::testing::Matcher&
128 |
129 | // The variable for mocking the given method.
130 | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
131 | #define GMOCK_MOCKER_(arity, constness, Method) \
132 | GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
133 |
134 |
135 | $for i [[
136 | $range j 1..i
137 | $var arg_as = [[$for j, \
138 | [[GMOCK_ARG_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
139 | $var as = [[$for j, [[gmock_a$j]]]]
140 | $var matcher_as = [[$for j, \
141 | [[GMOCK_MATCHER_(tn, $j, __VA_ARGS__) gmock_a$j]]]]
142 | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
143 | #define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, ...) \
144 | GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
145 | $arg_as) constness { \
146 | GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
147 | tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value == $i), \
148 | this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
149 | GMOCK_MOCKER_($i, constness, Method).SetOwnerAndName(this, #Method); \
150 | return GMOCK_MOCKER_($i, constness, Method).Invoke($as); \
151 | } \
152 | ::testing::MockSpec<__VA_ARGS__>& \
153 | gmock_##Method($matcher_as) constness { \
154 | GMOCK_MOCKER_($i, constness, Method).RegisterOwner(this); \
155 | return GMOCK_MOCKER_($i, constness, Method).With($as); \
156 | } \
157 | mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_($i, constness, Method)
158 |
159 |
160 | ]]
161 | $for i [[
162 | #define MOCK_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, , , m, __VA_ARGS__)
163 |
164 | ]]
165 |
166 |
167 | $for i [[
168 | #define MOCK_CONST_METHOD$i(m, ...) GMOCK_METHOD$i[[]]_(, const, , m, __VA_ARGS__)
169 |
170 | ]]
171 |
172 |
173 | $for i [[
174 | #define MOCK_METHOD$i[[]]_T(m, ...) GMOCK_METHOD$i[[]]_(typename, , , m, __VA_ARGS__)
175 |
176 | ]]
177 |
178 |
179 | $for i [[
180 | #define MOCK_CONST_METHOD$i[[]]_T(m, ...) \
181 | GMOCK_METHOD$i[[]]_(typename, const, , m, __VA_ARGS__)
182 |
183 | ]]
184 |
185 |
186 | $for i [[
187 | #define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
188 | GMOCK_METHOD$i[[]]_(, , ct, m, __VA_ARGS__)
189 |
190 | ]]
191 |
192 |
193 | $for i [[
194 | #define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, ...) \
195 | GMOCK_METHOD$i[[]]_(, const, ct, m, __VA_ARGS__)
196 |
197 | ]]
198 |
199 |
200 | $for i [[
201 | #define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
202 | GMOCK_METHOD$i[[]]_(typename, , ct, m, __VA_ARGS__)
203 |
204 | ]]
205 |
206 |
207 | $for i [[
208 | #define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, ...) \
209 | GMOCK_METHOD$i[[]]_(typename, const, ct, m, __VA_ARGS__)
210 |
211 | ]]
212 |
213 | // A MockFunction class has one mock method whose type is F. It is
214 | // useful when you just want your test code to emit some messages and
215 | // have Google Mock verify the right messages are sent (and perhaps at
216 | // the right times). For example, if you are exercising code:
217 | //
218 | // Foo(1);
219 | // Foo(2);
220 | // Foo(3);
221 | //
222 | // and want to verify that Foo(1) and Foo(3) both invoke
223 | // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
224 | //
225 | // TEST(FooTest, InvokesBarCorrectly) {
226 | // MyMock mock;
227 | // MockFunction check;
228 | // {
229 | // InSequence s;
230 | //
231 | // EXPECT_CALL(mock, Bar("a"));
232 | // EXPECT_CALL(check, Call("1"));
233 | // EXPECT_CALL(check, Call("2"));
234 | // EXPECT_CALL(mock, Bar("a"));
235 | // }
236 | // Foo(1);
237 | // check.Call("1");
238 | // Foo(2);
239 | // check.Call("2");
240 | // Foo(3);
241 | // }
242 | //
243 | // The expectation spec says that the first Bar("a") must happen
244 | // before check point "1", the second Bar("a") must happen after check
245 | // point "2", and nothing should happen between the two check
246 | // points. The explicit check points make it easy to tell which
247 | // Bar("a") is called by which call to Foo().
248 | //
249 | // MockFunction can also be used to exercise code that accepts
250 | // std::function callbacks. To do so, use AsStdFunction() method
251 | // to create std::function proxy forwarding to original object's Call.
252 | // Example:
253 | //
254 | // TEST(FooTest, RunsCallbackWithBarArgument) {
255 | // MockFunction callback;
256 | // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
257 | // Foo(callback.AsStdFunction());
258 | // }
259 | template
260 | class MockFunction;
261 |
262 |
263 | $for i [[
264 | $range j 0..i-1
265 | $var ArgTypes = [[$for j, [[A$j]]]]
266 | $var ArgNames = [[$for j, [[a$j]]]]
267 | $var ArgDecls = [[$for j, [[A$j a$j]]]]
268 | template
269 | class MockFunction {
270 | public:
271 | MockFunction() {}
272 |
273 | MOCK_METHOD$i[[]]_T(Call, R($ArgTypes));
274 |
275 | #if GTEST_HAS_STD_FUNCTION_
276 | std::function AsStdFunction() {
277 | return [this]($ArgDecls) -> R {
278 | return this->Call($ArgNames);
279 | };
280 | }
281 | #endif // GTEST_HAS_STD_FUNCTION_
282 |
283 | private:
284 | GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
285 | };
286 |
287 |
288 | ]]
289 | } // namespace testing
290 |
291 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
292 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock-generated-nice-strict.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $$ This is a Pump source file. Please use Pump to convert it to
3 | $$ gmock-generated-nice-strict.h.
4 | $$
5 | $var n = 10 $$ The maximum arity we support.
6 | // Copyright 2008, Google Inc.
7 | // All rights reserved.
8 | //
9 | // Redistribution and use in source and binary forms, with or without
10 | // modification, are permitted provided that the following conditions are
11 | // met:
12 | //
13 | // * Redistributions of source code must retain the above copyright
14 | // notice, this list of conditions and the following disclaimer.
15 | // * Redistributions in binary form must reproduce the above
16 | // copyright notice, this list of conditions and the following disclaimer
17 | // in the documentation and/or other materials provided with the
18 | // distribution.
19 | // * Neither the name of Google Inc. nor the names of its
20 | // contributors may be used to endorse or promote products derived from
21 | // this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | //
35 | // Author: wan@google.com (Zhanyong Wan)
36 |
37 | // Implements class templates NiceMock, NaggyMock, and StrictMock.
38 | //
39 | // Given a mock class MockFoo that is created using Google Mock,
40 | // NiceMock is a subclass of MockFoo that allows
41 | // uninteresting calls (i.e. calls to mock methods that have no
42 | // EXPECT_CALL specs), NaggyMock is a subclass of MockFoo
43 | // that prints a warning when an uninteresting call occurs, and
44 | // StrictMock is a subclass of MockFoo that treats all
45 | // uninteresting calls as errors.
46 | //
47 | // Currently a mock is naggy by default, so MockFoo and
48 | // NaggyMock behave like the same. However, we will soon
49 | // switch the default behavior of mocks to be nice, as that in general
50 | // leads to more maintainable tests. When that happens, MockFoo will
51 | // stop behaving like NaggyMock and start behaving like
52 | // NiceMock.
53 | //
54 | // NiceMock, NaggyMock, and StrictMock "inherit" the constructors of
55 | // their respective base class, with up-to $n arguments. Therefore
56 | // you can write NiceMock(5, "a") to construct a nice mock
57 | // where MockFoo has a constructor that accepts (int, const char*),
58 | // for example.
59 | //
60 | // A known limitation is that NiceMock, NaggyMock,
61 | // and StrictMock only works for mock methods defined using
62 | // the MOCK_METHOD* family of macros DIRECTLY in the MockFoo class.
63 | // If a mock method is defined in a base class of MockFoo, the "nice"
64 | // or "strict" modifier may not affect it, depending on the compiler.
65 | // In particular, nesting NiceMock, NaggyMock, and StrictMock is NOT
66 | // supported.
67 | //
68 | // Another known limitation is that the constructors of the base mock
69 | // cannot have arguments passed by non-const reference, which are
70 | // banned by the Google C++ style guide anyway.
71 |
72 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
73 | #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
74 |
75 | #include "gmock/gmock-spec-builders.h"
76 | #include "gmock/internal/gmock-port.h"
77 |
78 | namespace testing {
79 |
80 | $range kind 0..2
81 | $for kind [[
82 |
83 | $var clazz=[[$if kind==0 [[NiceMock]]
84 | $elif kind==1 [[NaggyMock]]
85 | $else [[StrictMock]]]]
86 |
87 | $var method=[[$if kind==0 [[AllowUninterestingCalls]]
88 | $elif kind==1 [[WarnUninterestingCalls]]
89 | $else [[FailUninterestingCalls]]]]
90 |
91 | template
92 | class $clazz : public MockClass {
93 | public:
94 | // We don't factor out the constructor body to a common method, as
95 | // we have to avoid a possible clash with members of MockClass.
96 | $clazz() {
97 | ::testing::Mock::$method(
98 | internal::ImplicitCast_(this));
99 | }
100 |
101 | // C++ doesn't (yet) allow inheritance of constructors, so we have
102 | // to define it for each arity.
103 | template
104 | explicit $clazz(const A1& a1) : MockClass(a1) {
105 | ::testing::Mock::$method(
106 | internal::ImplicitCast_(this));
107 | }
108 |
109 | $range i 2..n
110 | $for i [[
111 | $range j 1..i
112 | template <$for j, [[typename A$j]]>
113 | $clazz($for j, [[const A$j& a$j]]) : MockClass($for j, [[a$j]]) {
114 | ::testing::Mock::$method(
115 | internal::ImplicitCast_(this));
116 | }
117 |
118 |
119 | ]]
120 | virtual ~$clazz() {
121 | ::testing::Mock::UnregisterCallReaction(
122 | internal::ImplicitCast_(this));
123 | }
124 |
125 | private:
126 | GTEST_DISALLOW_COPY_AND_ASSIGN_($clazz);
127 | };
128 |
129 | ]]
130 |
131 | // The following specializations catch some (relatively more common)
132 | // user errors of nesting nice and strict mocks. They do NOT catch
133 | // all possible errors.
134 |
135 | // These specializations are declared but not defined, as NiceMock,
136 | // NaggyMock, and StrictMock cannot be nested.
137 |
138 | template
139 | class NiceMock >;
140 | template
141 | class NiceMock >;
142 | template
143 | class NiceMock >;
144 |
145 | template
146 | class NaggyMock >;
147 | template
148 | class NaggyMock >;
149 | template
150 | class NaggyMock >;
151 |
152 | template
153 | class StrictMock >;
154 | template
155 | class StrictMock >;
156 | template
157 | class StrictMock >;
158 |
159 | } // namespace testing
160 |
161 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_NICE_STRICT_H_
162 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock-more-actions.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: wan@google.com (Zhanyong Wan)
31 |
32 | // Google Mock - a framework for writing C++ mock classes.
33 | //
34 | // This file implements some actions that depend on gmock-generated-actions.h.
35 |
36 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
37 | #define GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
38 |
39 | #include
40 |
41 | #include "gmock/gmock-generated-actions.h"
42 |
43 | namespace testing {
44 | namespace internal {
45 |
46 | // Implements the Invoke(f) action. The template argument
47 | // FunctionImpl is the implementation type of f, which can be either a
48 | // function pointer or a functor. Invoke(f) can be used as an
49 | // Action as long as f's type is compatible with F (i.e. f can be
50 | // assigned to a tr1::function).
51 | template
52 | class InvokeAction {
53 | public:
54 | // The c'tor makes a copy of function_impl (either a function
55 | // pointer or a functor).
56 | explicit InvokeAction(FunctionImpl function_impl)
57 | : function_impl_(function_impl) {}
58 |
59 | template
60 | Result Perform(const ArgumentTuple& args) {
61 | return InvokeHelper::Invoke(function_impl_, args);
62 | }
63 |
64 | private:
65 | FunctionImpl function_impl_;
66 |
67 | GTEST_DISALLOW_ASSIGN_(InvokeAction);
68 | };
69 |
70 | // Implements the Invoke(object_ptr, &Class::Method) action.
71 | template
72 | class InvokeMethodAction {
73 | public:
74 | InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr)
75 | : method_ptr_(method_ptr), obj_ptr_(obj_ptr) {}
76 |
77 | template
78 | Result Perform(const ArgumentTuple& args) const {
79 | return InvokeHelper::InvokeMethod(
80 | obj_ptr_, method_ptr_, args);
81 | }
82 |
83 | private:
84 | // The order of these members matters. Reversing the order can trigger
85 | // warning C4121 in MSVC (see
86 | // http://computer-programming-forum.com/7-vc.net/6fbc30265f860ad1.htm ).
87 | const MethodPtr method_ptr_;
88 | Class* const obj_ptr_;
89 |
90 | GTEST_DISALLOW_ASSIGN_(InvokeMethodAction);
91 | };
92 |
93 | // An internal replacement for std::copy which mimics its behavior. This is
94 | // necessary because Visual Studio deprecates ::std::copy, issuing warning 4996.
95 | // However Visual Studio 2010 and later do not honor #pragmas which disable that
96 | // warning.
97 | template
98 | inline OutputIterator CopyElements(InputIterator first,
99 | InputIterator last,
100 | OutputIterator output) {
101 | for (; first != last; ++first, ++output) {
102 | *output = *first;
103 | }
104 | return output;
105 | }
106 |
107 | } // namespace internal
108 |
109 | // Various overloads for Invoke().
110 |
111 | // Creates an action that invokes 'function_impl' with the mock
112 | // function's arguments.
113 | template
114 | PolymorphicAction > Invoke(
115 | FunctionImpl function_impl) {
116 | return MakePolymorphicAction(
117 | internal::InvokeAction(function_impl));
118 | }
119 |
120 | // Creates an action that invokes the given method on the given object
121 | // with the mock function's arguments.
122 | template
123 | PolymorphicAction > Invoke(
124 | Class* obj_ptr, MethodPtr method_ptr) {
125 | return MakePolymorphicAction(
126 | internal::InvokeMethodAction(obj_ptr, method_ptr));
127 | }
128 |
129 | // WithoutArgs(inner_action) can be used in a mock function with a
130 | // non-empty argument list to perform inner_action, which takes no
131 | // argument. In other words, it adapts an action accepting no
132 | // argument to one that accepts (and ignores) arguments.
133 | template
134 | inline internal::WithArgsAction
135 | WithoutArgs(const InnerAction& action) {
136 | return internal::WithArgsAction(action);
137 | }
138 |
139 | // WithArg(an_action) creates an action that passes the k-th
140 | // (0-based) argument of the mock function to an_action and performs
141 | // it. It adapts an action accepting one argument to one that accepts
142 | // multiple arguments. For convenience, we also provide
143 | // WithArgs(an_action) (defined below) as a synonym.
144 | template
145 | inline internal::WithArgsAction
146 | WithArg(const InnerAction& action) {
147 | return internal::WithArgsAction(action);
148 | }
149 |
150 | // The ACTION*() macros trigger warning C4100 (unreferenced formal
151 | // parameter) in MSVC with -W4. Unfortunately they cannot be fixed in
152 | // the macro definition, as the warnings are generated when the macro
153 | // is expanded and macro expansion cannot contain #pragma. Therefore
154 | // we suppress them here.
155 | #ifdef _MSC_VER
156 | # pragma warning(push)
157 | # pragma warning(disable:4100)
158 | #endif
159 |
160 | // Action ReturnArg() returns the k-th argument of the mock function.
161 | ACTION_TEMPLATE(ReturnArg,
162 | HAS_1_TEMPLATE_PARAMS(int, k),
163 | AND_0_VALUE_PARAMS()) {
164 | return ::testing::get(args);
165 | }
166 |
167 | // Action SaveArg(pointer) saves the k-th (0-based) argument of the
168 | // mock function to *pointer.
169 | ACTION_TEMPLATE(SaveArg,
170 | HAS_1_TEMPLATE_PARAMS(int, k),
171 | AND_1_VALUE_PARAMS(pointer)) {
172 | *pointer = ::testing::get(args);
173 | }
174 |
175 | // Action SaveArgPointee(pointer) saves the value pointed to
176 | // by the k-th (0-based) argument of the mock function to *pointer.
177 | ACTION_TEMPLATE(SaveArgPointee,
178 | HAS_1_TEMPLATE_PARAMS(int, k),
179 | AND_1_VALUE_PARAMS(pointer)) {
180 | *pointer = *::testing::get(args);
181 | }
182 |
183 | // Action SetArgReferee(value) assigns 'value' to the variable
184 | // referenced by the k-th (0-based) argument of the mock function.
185 | ACTION_TEMPLATE(SetArgReferee,
186 | HAS_1_TEMPLATE_PARAMS(int, k),
187 | AND_1_VALUE_PARAMS(value)) {
188 | typedef typename ::testing::tuple_element::type argk_type;
189 | // Ensures that argument #k is a reference. If you get a compiler
190 | // error on the next line, you are using SetArgReferee(value) in
191 | // a mock function whose k-th (0-based) argument is not a reference.
192 | GTEST_COMPILE_ASSERT_(internal::is_reference::value,
193 | SetArgReferee_must_be_used_with_a_reference_argument);
194 | ::testing::get(args) = value;
195 | }
196 |
197 | // Action SetArrayArgument(first, last) copies the elements in
198 | // source range [first, last) to the array pointed to by the k-th
199 | // (0-based) argument, which can be either a pointer or an
200 | // iterator. The action does not take ownership of the elements in the
201 | // source range.
202 | ACTION_TEMPLATE(SetArrayArgument,
203 | HAS_1_TEMPLATE_PARAMS(int, k),
204 | AND_2_VALUE_PARAMS(first, last)) {
205 | // Visual Studio deprecates ::std::copy, so we use our own copy in that case.
206 | #ifdef _MSC_VER
207 | internal::CopyElements(first, last, ::testing::get(args));
208 | #else
209 | ::std::copy(first, last, ::testing::get(args));
210 | #endif
211 | }
212 |
213 | // Action DeleteArg() deletes the k-th (0-based) argument of the mock
214 | // function.
215 | ACTION_TEMPLATE(DeleteArg,
216 | HAS_1_TEMPLATE_PARAMS(int, k),
217 | AND_0_VALUE_PARAMS()) {
218 | delete ::testing::get(args);
219 | }
220 |
221 | // This action returns the value pointed to by 'pointer'.
222 | ACTION_P(ReturnPointee, pointer) { return *pointer; }
223 |
224 | // Action Throw(exception) can be used in a mock function of any type
225 | // to throw the given exception. Any copyable value can be thrown.
226 | #if GTEST_HAS_EXCEPTIONS
227 |
228 | // Suppresses the 'unreachable code' warning that VC generates in opt modes.
229 | # ifdef _MSC_VER
230 | # pragma warning(push) // Saves the current warning state.
231 | # pragma warning(disable:4702) // Temporarily disables warning 4702.
232 | # endif
233 | ACTION_P(Throw, exception) { throw exception; }
234 | # ifdef _MSC_VER
235 | # pragma warning(pop) // Restores the warning state.
236 | # endif
237 |
238 | #endif // GTEST_HAS_EXCEPTIONS
239 |
240 | #ifdef _MSC_VER
241 | # pragma warning(pop)
242 | #endif
243 |
244 | } // namespace testing
245 |
246 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_MORE_ACTIONS_H_
247 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock-more-matchers.h:
--------------------------------------------------------------------------------
1 | // Copyright 2013, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: marcus.boerger@google.com (Marcus Boerger)
31 |
32 | // Google Mock - a framework for writing C++ mock classes.
33 | //
34 | // This file implements some matchers that depend on gmock-generated-matchers.h.
35 | //
36 | // Note that tests are implemented in gmock-matchers_test.cc rather than
37 | // gmock-more-matchers-test.cc.
38 |
39 | #ifndef GMOCK_GMOCK_MORE_MATCHERS_H_
40 | #define GMOCK_GMOCK_MORE_MATCHERS_H_
41 |
42 | #include "gmock/gmock-generated-matchers.h"
43 |
44 | namespace testing {
45 |
46 | // Defines a matcher that matches an empty container. The container must
47 | // support both size() and empty(), which all STL-like containers provide.
48 | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
49 | if (arg.empty()) {
50 | return true;
51 | }
52 | *result_listener << "whose size is " << arg.size();
53 | return false;
54 | }
55 |
56 | } // namespace testing
57 |
58 | #endif // GMOCK_GMOCK_MORE_MATCHERS_H_
59 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/gmock.h:
--------------------------------------------------------------------------------
1 | // Copyright 2007, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: wan@google.com (Zhanyong Wan)
31 |
32 | // Google Mock - a framework for writing C++ mock classes.
33 | //
34 | // This is the main header file a user should include.
35 |
36 | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_
37 | #define GMOCK_INCLUDE_GMOCK_GMOCK_H_
38 |
39 | // This file implements the following syntax:
40 | //
41 | // ON_CALL(mock_object.Method(...))
42 | // .With(...) ?
43 | // .WillByDefault(...);
44 | //
45 | // where With() is optional and WillByDefault() must appear exactly
46 | // once.
47 | //
48 | // EXPECT_CALL(mock_object.Method(...))
49 | // .With(...) ?
50 | // .Times(...) ?
51 | // .InSequence(...) *
52 | // .WillOnce(...) *
53 | // .WillRepeatedly(...) ?
54 | // .RetiresOnSaturation() ? ;
55 | //
56 | // where all clauses are optional and WillOnce() can be repeated.
57 |
58 | #include "gmock/gmock-actions.h"
59 | #include "gmock/gmock-cardinalities.h"
60 | #include "gmock/gmock-generated-actions.h"
61 | #include "gmock/gmock-generated-function-mockers.h"
62 | #include "gmock/gmock-generated-nice-strict.h"
63 | #include "gmock/gmock-generated-matchers.h"
64 | #include "gmock/gmock-matchers.h"
65 | #include "gmock/gmock-more-actions.h"
66 | #include "gmock/gmock-more-matchers.h"
67 | #include "gmock/internal/gmock-internal-utils.h"
68 |
69 | namespace testing {
70 |
71 | // Declares Google Mock flags that we want a user to use programmatically.
72 | GMOCK_DECLARE_bool_(catch_leaked_mocks);
73 | GMOCK_DECLARE_string_(verbose);
74 |
75 | // Initializes Google Mock. This must be called before running the
76 | // tests. In particular, it parses the command line for the flags
77 | // that Google Mock recognizes. Whenever a Google Mock flag is seen,
78 | // it is removed from argv, and *argc is decremented.
79 | //
80 | // No value is returned. Instead, the Google Mock flag variables are
81 | // updated.
82 | //
83 | // Since Google Test is needed for Google Mock to work, this function
84 | // also initializes Google Test and parses its flags, if that hasn't
85 | // been done.
86 | GTEST_API_ void InitGoogleMock(int* argc, char** argv);
87 |
88 | // This overloaded version can be used in Windows programs compiled in
89 | // UNICODE mode.
90 | GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
91 |
92 | } // namespace testing
93 |
94 | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_
95 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/custom/gmock-generated-actions.h:
--------------------------------------------------------------------------------
1 | // This file was GENERATED by command:
2 | // pump.py gmock-generated-actions.h.pump
3 | // DO NOT EDIT BY HAND!!!
4 |
5 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
6 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
7 |
8 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
9 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/custom/gmock-generated-actions.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $$ This is a Pump source file (http://go/pump). Please use Pump to convert
3 | $$ it to callback-actions.h.
4 | $$
5 | $var max_callback_arity = 5
6 | $$}} This meta comment fixes auto-indentation in editors.
7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
9 |
10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
11 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/custom/gmock-matchers.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // ============================================================
31 | // An installation-specific extension point for gmock-matchers.h.
32 | // ============================================================
33 | //
34 | // Adds google3 callback support to CallableTraits.
35 | //
36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
38 |
39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_
40 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/custom/gmock-port.h:
--------------------------------------------------------------------------------
1 | // Copyright 2015, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Injection point for custom user configurations.
31 | // The following macros can be defined:
32 | //
33 | // Flag related macros:
34 | // GMOCK_DECLARE_bool_(name)
35 | // GMOCK_DECLARE_int32_(name)
36 | // GMOCK_DECLARE_string_(name)
37 | // GMOCK_DEFINE_bool_(name, default_val, doc)
38 | // GMOCK_DEFINE_int32_(name, default_val, doc)
39 | // GMOCK_DEFINE_string_(name, default_val, doc)
40 | //
41 | // ** Custom implementation starts here **
42 |
43 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
44 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
45 |
46 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
47 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/gmock-generated-internal-utils.h:
--------------------------------------------------------------------------------
1 | // This file was GENERATED by command:
2 | // pump.py gmock-generated-internal-utils.h.pump
3 | // DO NOT EDIT BY HAND!!!
4 |
5 | // Copyright 2007, Google Inc.
6 | // All rights reserved.
7 | //
8 | // Redistribution and use in source and binary forms, with or without
9 | // modification, are permitted provided that the following conditions are
10 | // met:
11 | //
12 | // * Redistributions of source code must retain the above copyright
13 | // notice, this list of conditions and the following disclaimer.
14 | // * Redistributions in binary form must reproduce the above
15 | // copyright notice, this list of conditions and the following disclaimer
16 | // in the documentation and/or other materials provided with the
17 | // distribution.
18 | // * Neither the name of Google Inc. nor the names of its
19 | // contributors may be used to endorse or promote products derived from
20 | // this software without specific prior written permission.
21 | //
22 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 | //
34 | // Author: wan@google.com (Zhanyong Wan)
35 |
36 | // Google Mock - a framework for writing C++ mock classes.
37 | //
38 | // This file contains template meta-programming utility classes needed
39 | // for implementing Google Mock.
40 |
41 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
42 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
43 |
44 | #include "gmock/internal/gmock-port.h"
45 |
46 | namespace testing {
47 |
48 | template
49 | class Matcher;
50 |
51 | namespace internal {
52 |
53 | // An IgnoredValue object can be implicitly constructed from ANY value.
54 | // This is used in implementing the IgnoreResult(a) action.
55 | class IgnoredValue {
56 | public:
57 | // This constructor template allows any value to be implicitly
58 | // converted to IgnoredValue. The object has no data member and
59 | // doesn't try to remember anything about the argument. We
60 | // deliberately omit the 'explicit' keyword in order to allow the
61 | // conversion to be implicit.
62 | template
63 | IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
64 | };
65 |
66 | // MatcherTuple::type is a tuple type where each field is a Matcher
67 | // for the corresponding field in tuple type T.
68 | template
69 | struct MatcherTuple;
70 |
71 | template <>
72 | struct MatcherTuple< ::testing::tuple<> > {
73 | typedef ::testing::tuple< > type;
74 | };
75 |
76 | template
77 | struct MatcherTuple< ::testing::tuple > {
78 | typedef ::testing::tuple > type;
79 | };
80 |
81 | template
82 | struct MatcherTuple< ::testing::tuple > {
83 | typedef ::testing::tuple, Matcher > type;
84 | };
85 |
86 | template
87 | struct MatcherTuple< ::testing::tuple > {
88 | typedef ::testing::tuple, Matcher, Matcher > type;
89 | };
90 |
91 | template
92 | struct MatcherTuple< ::testing::tuple > {
93 | typedef ::testing::tuple, Matcher, Matcher,
94 | Matcher > type;
95 | };
96 |
97 | template
98 | struct MatcherTuple< ::testing::tuple > {
99 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
100 | Matcher > type;
101 | };
102 |
103 | template
105 | struct MatcherTuple< ::testing::tuple > {
106 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
107 | Matcher, Matcher > type;
108 | };
109 |
110 | template
112 | struct MatcherTuple< ::testing::tuple > {
113 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
114 | Matcher, Matcher, Matcher > type;
115 | };
116 |
117 | template
119 | struct MatcherTuple< ::testing::tuple > {
120 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
121 | Matcher, Matcher, Matcher, Matcher > type;
122 | };
123 |
124 | template
126 | struct MatcherTuple< ::testing::tuple > {
127 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
128 | Matcher, Matcher, Matcher, Matcher, Matcher > type;
129 | };
130 |
131 | template
133 | struct MatcherTuple< ::testing::tuple > {
135 | typedef ::testing::tuple, Matcher, Matcher, Matcher,
136 | Matcher, Matcher, Matcher, Matcher, Matcher,
137 | Matcher > type;
138 | };
139 |
140 | // Template struct Function, where F must be a function type, contains
141 | // the following typedefs:
142 | //
143 | // Result: the function's return type.
144 | // ArgumentN: the type of the N-th argument, where N starts with 1.
145 | // ArgumentTuple: the tuple type consisting of all parameters of F.
146 | // ArgumentMatcherTuple: the tuple type consisting of Matchers for all
147 | // parameters of F.
148 | // MakeResultVoid: the function type obtained by substituting void
149 | // for the return type of F.
150 | // MakeResultIgnoredValue:
151 | // the function type obtained by substituting Something
152 | // for the return type of F.
153 | template
154 | struct Function;
155 |
156 | template
157 | struct Function {
158 | typedef R Result;
159 | typedef ::testing::tuple<> ArgumentTuple;
160 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
161 | typedef void MakeResultVoid();
162 | typedef IgnoredValue MakeResultIgnoredValue();
163 | };
164 |
165 | template
166 | struct Function
167 | : Function {
168 | typedef A1 Argument1;
169 | typedef ::testing::tuple ArgumentTuple;
170 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
171 | typedef void MakeResultVoid(A1);
172 | typedef IgnoredValue MakeResultIgnoredValue(A1);
173 | };
174 |
175 | template
176 | struct Function
177 | : Function {
178 | typedef A2 Argument2;
179 | typedef ::testing::tuple ArgumentTuple;
180 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
181 | typedef void MakeResultVoid(A1, A2);
182 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2);
183 | };
184 |
185 | template
186 | struct Function
187 | : Function {
188 | typedef A3 Argument3;
189 | typedef ::testing::tuple ArgumentTuple;
190 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
191 | typedef void MakeResultVoid(A1, A2, A3);
192 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3);
193 | };
194 |
195 | template
196 | struct Function
197 | : Function {
198 | typedef A4 Argument4;
199 | typedef ::testing::tuple ArgumentTuple;
200 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
201 | typedef void MakeResultVoid(A1, A2, A3, A4);
202 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4);
203 | };
204 |
205 | template
207 | struct Function
208 | : Function {
209 | typedef A5 Argument5;
210 | typedef ::testing::tuple ArgumentTuple;
211 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
212 | typedef void MakeResultVoid(A1, A2, A3, A4, A5);
213 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5);
214 | };
215 |
216 | template
218 | struct Function
219 | : Function {
220 | typedef A6 Argument6;
221 | typedef ::testing::tuple ArgumentTuple;
222 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
223 | typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6);
224 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6);
225 | };
226 |
227 | template
229 | struct Function
230 | : Function {
231 | typedef A7 Argument7;
232 | typedef ::testing::tuple ArgumentTuple;
233 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
234 | typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7);
235 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7);
236 | };
237 |
238 | template
240 | struct Function
241 | : Function {
242 | typedef A8 Argument8;
243 | typedef ::testing::tuple ArgumentTuple;
244 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
245 | typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8);
246 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8);
247 | };
248 |
249 | template
251 | struct Function
252 | : Function {
253 | typedef A9 Argument9;
254 | typedef ::testing::tuple ArgumentTuple;
255 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
256 | typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9);
257 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
258 | A9);
259 | };
260 |
261 | template
264 | struct Function
265 | : Function {
266 | typedef A10 Argument10;
267 | typedef ::testing::tuple ArgumentTuple;
269 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
270 | typedef void MakeResultVoid(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
271 | typedef IgnoredValue MakeResultIgnoredValue(A1, A2, A3, A4, A5, A6, A7, A8,
272 | A9, A10);
273 | };
274 |
275 | } // namespace internal
276 |
277 | } // namespace testing
278 |
279 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
280 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/gmock-generated-internal-utils.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $$ This is a Pump source file. Please use Pump to convert it to
3 | $$ gmock-generated-function-mockers.h.
4 | $$
5 | $var n = 10 $$ The maximum arity we support.
6 | // Copyright 2007, Google Inc.
7 | // All rights reserved.
8 | //
9 | // Redistribution and use in source and binary forms, with or without
10 | // modification, are permitted provided that the following conditions are
11 | // met:
12 | //
13 | // * Redistributions of source code must retain the above copyright
14 | // notice, this list of conditions and the following disclaimer.
15 | // * Redistributions in binary form must reproduce the above
16 | // copyright notice, this list of conditions and the following disclaimer
17 | // in the documentation and/or other materials provided with the
18 | // distribution.
19 | // * Neither the name of Google Inc. nor the names of its
20 | // contributors may be used to endorse or promote products derived from
21 | // this software without specific prior written permission.
22 | //
23 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | //
35 | // Author: wan@google.com (Zhanyong Wan)
36 |
37 | // Google Mock - a framework for writing C++ mock classes.
38 | //
39 | // This file contains template meta-programming utility classes needed
40 | // for implementing Google Mock.
41 |
42 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
43 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
44 |
45 | #include "gmock/internal/gmock-port.h"
46 |
47 | namespace testing {
48 |
49 | template
50 | class Matcher;
51 |
52 | namespace internal {
53 |
54 | // An IgnoredValue object can be implicitly constructed from ANY value.
55 | // This is used in implementing the IgnoreResult(a) action.
56 | class IgnoredValue {
57 | public:
58 | // This constructor template allows any value to be implicitly
59 | // converted to IgnoredValue. The object has no data member and
60 | // doesn't try to remember anything about the argument. We
61 | // deliberately omit the 'explicit' keyword in order to allow the
62 | // conversion to be implicit.
63 | template
64 | IgnoredValue(const T& /* ignored */) {} // NOLINT(runtime/explicit)
65 | };
66 |
67 | // MatcherTuple::type is a tuple type where each field is a Matcher
68 | // for the corresponding field in tuple type T.
69 | template
70 | struct MatcherTuple;
71 |
72 |
73 | $range i 0..n
74 | $for i [[
75 | $range j 1..i
76 | $var typename_As = [[$for j, [[typename A$j]]]]
77 | $var As = [[$for j, [[A$j]]]]
78 | $var matcher_As = [[$for j, [[Matcher]]]]
79 | template <$typename_As>
80 | struct MatcherTuple< ::testing::tuple<$As> > {
81 | typedef ::testing::tuple<$matcher_As > type;
82 | };
83 |
84 |
85 | ]]
86 | // Template struct Function, where F must be a function type, contains
87 | // the following typedefs:
88 | //
89 | // Result: the function's return type.
90 | // ArgumentN: the type of the N-th argument, where N starts with 1.
91 | // ArgumentTuple: the tuple type consisting of all parameters of F.
92 | // ArgumentMatcherTuple: the tuple type consisting of Matchers for all
93 | // parameters of F.
94 | // MakeResultVoid: the function type obtained by substituting void
95 | // for the return type of F.
96 | // MakeResultIgnoredValue:
97 | // the function type obtained by substituting Something
98 | // for the return type of F.
99 | template
100 | struct Function;
101 |
102 | template
103 | struct Function {
104 | typedef R Result;
105 | typedef ::testing::tuple<> ArgumentTuple;
106 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
107 | typedef void MakeResultVoid();
108 | typedef IgnoredValue MakeResultIgnoredValue();
109 | };
110 |
111 |
112 | $range i 1..n
113 | $for i [[
114 | $range j 1..i
115 | $var typename_As = [[$for j [[, typename A$j]]]]
116 | $var As = [[$for j, [[A$j]]]]
117 | $var matcher_As = [[$for j, [[Matcher]]]]
118 | $range k 1..i-1
119 | $var prev_As = [[$for k, [[A$k]]]]
120 | template
121 | struct Function
122 | : Function {
123 | typedef A$i Argument$i;
124 | typedef ::testing::tuple<$As> ArgumentTuple;
125 | typedef typename MatcherTuple::type ArgumentMatcherTuple;
126 | typedef void MakeResultVoid($As);
127 | typedef IgnoredValue MakeResultIgnoredValue($As);
128 | };
129 |
130 |
131 | ]]
132 | } // namespace internal
133 |
134 | } // namespace testing
135 |
136 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_GENERATED_INTERNAL_UTILS_H_
137 |
--------------------------------------------------------------------------------
/Libraries/build/include/gmock/internal/gmock-port.h:
--------------------------------------------------------------------------------
1 | // Copyright 2008, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: vadimb@google.com (Vadim Berman)
31 | //
32 | // Low-level types and utilities for porting Google Mock to various
33 | // platforms. All macros ending with _ and symbols defined in an
34 | // internal namespace are subject to change without notice. Code
35 | // outside Google Mock MUST NOT USE THEM DIRECTLY. Macros that don't
36 | // end with _ are part of Google Mock's public API and can be used by
37 | // code outside Google Mock.
38 |
39 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
40 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
41 |
42 | #include
43 | #include
44 | #include
45 |
46 | // Most of the utilities needed for porting Google Mock are also
47 | // required for Google Test and are defined in gtest-port.h.
48 | //
49 | // Note to maintainers: to reduce code duplication, prefer adding
50 | // portability utilities to Google Test's gtest-port.h instead of
51 | // here, as Google Mock depends on Google Test. Only add a utility
52 | // here if it's truly specific to Google Mock.
53 | #include "gtest/internal/gtest-linked_ptr.h"
54 | #include "gtest/internal/gtest-port.h"
55 | #include "gmock/internal/custom/gmock-port.h"
56 |
57 | // To avoid conditional compilation everywhere, we make it
58 | // gmock-port.h's responsibility to #include the header implementing
59 | // tr1/tuple. gmock-port.h does this via gtest-port.h, which is
60 | // guaranteed to pull in the tuple header.
61 |
62 | // For MS Visual C++, check the compiler version. At least VS 2003 is
63 | // required to compile Google Mock.
64 | #if defined(_MSC_VER) && _MSC_VER < 1310
65 | # error "At least Visual C++ 2003 (7.1) is required to compile Google Mock."
66 | #endif
67 |
68 | // Macro for referencing flags. This is public as we want the user to
69 | // use this syntax to reference Google Mock flags.
70 | #define GMOCK_FLAG(name) FLAGS_gmock_##name
71 |
72 | #if !defined(GMOCK_DECLARE_bool_)
73 |
74 | // Macros for declaring flags.
75 | #define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name)
76 | #define GMOCK_DECLARE_int32_(name) \
77 | extern GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name)
78 | #define GMOCK_DECLARE_string_(name) \
79 | extern GTEST_API_ ::std::string GMOCK_FLAG(name)
80 |
81 | // Macros for defining flags.
82 | #define GMOCK_DEFINE_bool_(name, default_val, doc) \
83 | GTEST_API_ bool GMOCK_FLAG(name) = (default_val)
84 | #define GMOCK_DEFINE_int32_(name, default_val, doc) \
85 | GTEST_API_ ::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
86 | #define GMOCK_DEFINE_string_(name, default_val, doc) \
87 | GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val)
88 |
89 | #endif // !defined(GMOCK_DECLARE_bool_)
90 |
91 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_
92 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/gtest-message.h:
--------------------------------------------------------------------------------
1 | // Copyright 2005, Google Inc.
2 | // All rights reserved.
3 | //
4 | // Redistribution and use in source and binary forms, with or without
5 | // modification, are permitted provided that the following conditions are
6 | // met:
7 | //
8 | // * Redistributions of source code must retain the above copyright
9 | // notice, this list of conditions and the following disclaimer.
10 | // * Redistributions in binary form must reproduce the above
11 | // copyright notice, this list of conditions and the following disclaimer
12 | // in the documentation and/or other materials provided with the
13 | // distribution.
14 | // * Neither the name of Google Inc. nor the names of its
15 | // contributors may be used to endorse or promote products derived from
16 | // this software without specific prior written permission.
17 | //
18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 | //
30 | // Author: wan@google.com (Zhanyong Wan)
31 | //
32 | // The Google C++ Testing Framework (Google Test)
33 | //
34 | // This header file defines the Message class.
35 | //
36 | // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
37 | // leave some internal implementation details in this header file.
38 | // They are clearly marked by comments like this:
39 | //
40 | // // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
41 | //
42 | // Such code is NOT meant to be used by a user directly, and is subject
43 | // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user
44 | // program!
45 |
46 | #ifndef GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
47 | #define GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
48 |
49 | #include