├── .github
├── FUNDING.yml
└── workflows
│ └── ci-mac.yaml
├── Libraries
├── tmp
│ ├── build
│ │ └── .gitignore
│ └── .gitignore
├── build
│ ├── lib
│ │ ├── osx
│ │ │ ├── libgmock.a
│ │ │ ├── libgtest.a
│ │ │ ├── libgmock_main.a
│ │ │ └── libgtest_main.a
│ │ └── linux
│ │ │ ├── libgmock.a
│ │ │ ├── libgtest.a
│ │ │ ├── libgmock_main.a
│ │ │ └── libgtest_main.a
│ └── include
│ │ ├── gmock
│ │ ├── internal
│ │ │ ├── custom
│ │ │ │ ├── gmock-generated-actions.h
│ │ │ │ ├── gmock-generated-actions.h.pump
│ │ │ │ ├── gmock-matchers.h
│ │ │ │ └── gmock-port.h
│ │ │ ├── gmock-port.h
│ │ │ ├── gmock-generated-internal-utils.h.pump
│ │ │ └── gmock-generated-internal-utils.h
│ │ ├── gmock-more-matchers.h
│ │ ├── gmock.h
│ │ ├── gmock-cardinalities.h
│ │ ├── gmock-generated-nice-strict.h.pump
│ │ ├── gmock-more-actions.h
│ │ └── gmock-generated-function-mockers.h.pump
│ │ └── gtest
│ │ ├── internal
│ │ ├── custom
│ │ │ ├── gtest.h
│ │ │ ├── gtest-printers.h
│ │ │ └── gtest-port.h
│ │ ├── gtest-port-arch.h
│ │ ├── gtest-string.h
│ │ ├── gtest-linked_ptr.h
│ │ ├── gtest-filepath.h
│ │ ├── gtest-param-util-generated.h.pump
│ │ ├── gtest-type-util.h.pump
│ │ └── gtest-tuple.h.pump
│ │ ├── gtest_prod.h
│ │ ├── gtest-test-part.h
│ │ ├── gtest-message.h
│ │ ├── gtest-spi.h
│ │ └── gtest-typed-test.h
└── Makefile
├── .gitmodules
├── GoogleMock.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ └── GoogleMock.xcscheme
├── .gitignore
├── GoogleMockTests
├── Info.plist
└── Test.cpp
├── GoogleMock
├── gmock-Info.plist
├── gtest-Info.plist
├── GoogleMock-Info.plist
├── GoogleMock.h
└── Classes
│ └── GMXCTestBridge.mm
├── LICENSE
├── README.md
└── CODE_OF_CONDUCT.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: macmade
2 |
--------------------------------------------------------------------------------
/Libraries/tmp/build/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/Libraries/tmp/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 | !build
4 |
--------------------------------------------------------------------------------
/Libraries/build/lib/osx/libgmock.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/osx/libgmock.a
--------------------------------------------------------------------------------
/Libraries/build/lib/osx/libgtest.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/osx/libgtest.a
--------------------------------------------------------------------------------
/Libraries/build/lib/linux/libgmock.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/linux/libgmock.a
--------------------------------------------------------------------------------
/Libraries/build/lib/linux/libgtest.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/linux/libgtest.a
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Submodules/xcconfig"]
2 | path = Submodules/xcconfig
3 | url = https://github.com/macmade/xcconfig.git
4 |
--------------------------------------------------------------------------------
/Libraries/build/lib/osx/libgmock_main.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/osx/libgmock_main.a
--------------------------------------------------------------------------------
/Libraries/build/lib/osx/libgtest_main.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/osx/libgtest_main.a
--------------------------------------------------------------------------------
/Libraries/build/lib/linux/libgmock_main.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/linux/libgmock_main.a
--------------------------------------------------------------------------------
/Libraries/build/lib/linux/libgtest_main.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/macmade/gmock-xcode/HEAD/Libraries/build/lib/linux/libgtest_main.a
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/custom/gtest.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 | // GTEST_OS_STACK_TRACE_GETTER_ - The name of an implementation of
34 | // OsStackTraceGetterInterface.
35 | //
36 | // ** Custom implementation starts here **
37 |
38 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
39 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
40 |
41 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
42 |
--------------------------------------------------------------------------------
/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/gtest/internal/custom/gtest-printers.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 | // This file provides an injection point for custom printers in a local
31 | // installation of gTest.
32 | // It will be included from gtest-printers.h and the overrides in this file
33 | // will be visible to everyone.
34 | // See documentation at gtest/gtest-printers.h for details on how to define a
35 | // custom printer.
36 | //
37 | // ** Custom implementation starts here **
38 |
39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
41 |
42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
43 |
--------------------------------------------------------------------------------
/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/gtest/gtest_prod.h:
--------------------------------------------------------------------------------
1 | // Copyright 2006, 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 C++ Testing Framework definitions useful in production code.
33 |
34 | #ifndef GTEST_INCLUDE_GTEST_GTEST_PROD_H_
35 | #define GTEST_INCLUDE_GTEST_GTEST_PROD_H_
36 |
37 | // When you need to test the private or protected members of a class,
38 | // use the FRIEND_TEST macro to declare your tests as friends of the
39 | // class. For example:
40 | //
41 | // class MyClass {
42 | // private:
43 | // void MyMethod();
44 | // FRIEND_TEST(MyClassTest, MyMethod);
45 | // };
46 | //
47 | // class MyClassTest : public testing::Test {
48 | // // ...
49 | // };
50 | //
51 | // TEST_F(MyClassTest, MyMethod) {
52 | // // Can call MyClass::MyMethod() here.
53 | // }
54 |
55 | #define FRIEND_TEST(test_case_name, test_name)\
56 | friend class test_case_name##_##test_name##_Test
57 |
58 | #endif // GTEST_INCLUDE_GTEST_GTEST_PROD_H_
59 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/custom/gtest-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 | // GTEST_FLAG(flag_name)
35 | // GTEST_USE_OWN_FLAGFILE_FLAG_ - Define to 0 when the system provides its
36 | // own flagfile flag parsing.
37 | // GTEST_DECLARE_bool_(name)
38 | // GTEST_DECLARE_int32_(name)
39 | // GTEST_DECLARE_string_(name)
40 | // GTEST_DEFINE_bool_(name, default_val, doc)
41 | // GTEST_DEFINE_int32_(name, default_val, doc)
42 | // GTEST_DEFINE_string_(name, default_val, doc)
43 | //
44 | // Test filtering:
45 | // GTEST_TEST_FILTER_ENV_VAR_ - The name of an environment variable that
46 | // will be used if --GTEST_FLAG(test_filter)
47 | // is not provided.
48 | //
49 | // Logging:
50 | // GTEST_LOG_(severity)
51 | // GTEST_CHECK_(condition)
52 | // Functions LogToStderr() and FlushInfoLog() have to be provided too.
53 | //
54 | // Threading:
55 | // GTEST_HAS_NOTIFICATION_ - Enabled if Notification is already provided.
56 | // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ - Enabled if Mutex and ThreadLocal are
57 | // already provided.
58 | // Must also provide GTEST_DECLARE_STATIC_MUTEX_(mutex) and
59 | // GTEST_DEFINE_STATIC_MUTEX_(mutex)
60 | //
61 | // GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)
62 | // GTEST_LOCK_EXCLUDED_(locks)
63 | //
64 | // ** Custom implementation starts here **
65 |
66 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
67 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
68 |
69 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
70 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-port-arch.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 | // The Google C++ Testing Framework (Google Test)
31 | //
32 | // This header file defines the GTEST_OS_* macro.
33 | // It is separate from gtest-port.h so that custom/gtest-port.h can include it.
34 |
35 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
36 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
37 |
38 | // Determines the platform on which Google Test is compiled.
39 | #ifdef __CYGWIN__
40 | # define GTEST_OS_CYGWIN 1
41 | #elif defined __SYMBIAN32__
42 | # define GTEST_OS_SYMBIAN 1
43 | #elif defined _WIN32
44 | # define GTEST_OS_WINDOWS 1
45 | # ifdef _WIN32_WCE
46 | # define GTEST_OS_WINDOWS_MOBILE 1
47 | # elif defined(__MINGW__) || defined(__MINGW32__)
48 | # define GTEST_OS_WINDOWS_MINGW 1
49 | # elif defined(WINAPI_FAMILY)
50 | # include
51 | # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
52 | # define GTEST_OS_WINDOWS_DESKTOP 1
53 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
54 | # define GTEST_OS_WINDOWS_PHONE 1
55 | # elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
56 | # define GTEST_OS_WINDOWS_RT 1
57 | # else
58 | // WINAPI_FAMILY defined but no known partition matched.
59 | // Default to desktop.
60 | # define GTEST_OS_WINDOWS_DESKTOP 1
61 | # endif
62 | # else
63 | # define GTEST_OS_WINDOWS_DESKTOP 1
64 | # endif // _WIN32_WCE
65 | #elif defined __APPLE__
66 | # define GTEST_OS_MAC 1
67 | # if TARGET_OS_IPHONE
68 | # define GTEST_OS_IOS 1
69 | # endif
70 | #elif defined __FreeBSD__
71 | # define GTEST_OS_FREEBSD 1
72 | #elif defined __linux__
73 | # define GTEST_OS_LINUX 1
74 | # if defined __ANDROID__
75 | # define GTEST_OS_LINUX_ANDROID 1
76 | # endif
77 | #elif defined __MVS__
78 | # define GTEST_OS_ZOS 1
79 | #elif defined(__sun) && defined(__SVR4)
80 | # define GTEST_OS_SOLARIS 1
81 | #elif defined(_AIX)
82 | # define GTEST_OS_AIX 1
83 | #elif defined(__hpux)
84 | # define GTEST_OS_HPUX 1
85 | #elif defined __native_client__
86 | # define GTEST_OS_NACL 1
87 | #elif defined __OpenBSD__
88 | # define GTEST_OS_OPENBSD 1
89 | #elif defined __QNX__
90 | # define GTEST_OS_QNX 1
91 | #endif // __CYGWIN__
92 |
93 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_ARCH_H_
94 |
--------------------------------------------------------------------------------
/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/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/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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GoogleMock - Xcode
2 | ==================
3 |
4 | [](https://github.com/macmade/gmock-xcode/actions/workflows/ci-mac.yaml)
5 | [](https://github.com/macmade/gmock-xcode/issues)
6 | 
7 | 
8 | [](https://twitter.com/macmade)
9 | [](https://github.com/sponsors/macmade)
10 |
11 | About
12 | -----
13 |
14 | This project consists of an integration of the GoogleMock library to Apple's Xcode IDE.
15 |
16 | Since version 5, Xcode provides a nice way to write unit tests with the `XCTest` framework.
17 | Unit tests written with `XCTest` are integrated to the IDE, providing visual feedback when running tests. They are also integrated with the different build toolchains, like `xcodebuild` or Facebook's `xctool`.
18 |
19 | It was specifially designed for Objective-C, writing unit tests for other languages (such as C++) is not so great with `XCTest`.
20 | Of course, this is possible using Objective-C++, but writing an Objective-C class for each C++ test case leads to some undesired overhead.
21 |
22 | GoogleMock is nice unit testing library for C++. The only issue is that it does not integrate well with Xcode, as does `XCTest`.
23 | This mean the IDE won't provide visual feedback for the unit tests written with GoogleMock, and you'll have to look at the console output to inspect any failed test.
24 |
25 | So this project fixes this issue by bridging GoogleMock to `XCTest`.
26 |
27 | ### Implementation details
28 |
29 | `XCTest` works by analysing test classes at runtime, thanks to Objective-C dynamic nature.
30 | Basically, when the test bundle is loaded, it will look for all classes extending `XCTestCase`, and look for methods beginning with the `test` prefix.
31 |
32 | If such a class is available, it will then create an instance, and launch each test method, reporting the result to the IDE.
33 |
34 | This project consists of a framework which has to be linked to the unit test bundle. The framework includes GoogleMock, so you don't have to build it by yourself.
35 |
36 | It works by querying each GoogleMock test case. For each one, a specific subclass of `XCTestCase` will be dynamically created at runtime.
37 | For each test in a test case, an Objective-C method will be created and added to the `XCTestCase` subclass.
38 |
39 | The GoogleMock test cases are then run, reporting the usual output to the console.
40 |
41 | Then, as we created new classes compatible with `XCTest`, it will find them, and run them as usual.
42 | Each method will simply look at the GoogleMock test result, and report the status using `XCTest` assertions, so we got visual feedback, as if we had written our test cases using `XCTest`.
43 |
44 |
45 | Project Configuration
46 | ---------------------
47 |
48 | In order to use these features, your unit test bundle needs to be linked to the provided frameworks.
49 |
50 | The easiest way to do this is to include the provided Xcode project (`GoogleMock.xcodeproj`) as a subproject of your own Xcode project, so all targets are available.
51 |
52 | Then, from the `Build Phases` screen of your unit test's target, add the following frameworks to the `Target Dependancies` step:
53 |
54 | * GoogleMock
55 |
56 | Adds the same frameworks to the `Link Binary With Libraries` step, and you're done.
57 | Your unit test bundle is now ready to use GoogleMock.
58 |
59 |
60 | Writing tests
61 | -------------
62 |
63 | Writing GoogleMock tests is also straightforward.
64 | Simply include `` to your `.cpp` file, and write your tests as usual.
65 |
66 | For instance:
67 |
68 | #include
69 |
70 | using namespace testing;
71 |
72 | TEST( MyTestCase, MyTest )
73 | {
74 | ASSERT_TRUE( true );
75 | }
76 |
77 | In the above example, a subclass of `XCTestCase` named `MyTestCase` will be created at runtime, with a test method called `testMyTest`, so you can easily inspect the results of your GoogleMock tests directly from the Xcode tests tab.
78 |
79 | License
80 | -------
81 |
82 | The GoogleMock Xcode integration library is released under the terms of the MIT License.
83 |
84 | Repository Infos
85 | ----------------
86 |
87 | Owner: Jean-David Gadina - XS-Labs
88 | Web: www.xs-labs.com
89 | Blog: www.noxeos.com
90 | Twitter: @macmade
91 | GitHub: github.com/macmade
92 | LinkedIn: ch.linkedin.com/in/macmade/
93 | StackOverflow: stackoverflow.com/users/182676/macmade
94 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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-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/gtest/gtest-test-part.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: mheule@google.com (Markus Heule)
31 | //
32 |
33 | #ifndef GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
34 | #define GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
35 |
36 | #include
37 | #include
38 | #include "gtest/internal/gtest-internal.h"
39 | #include "gtest/internal/gtest-string.h"
40 |
41 | namespace testing {
42 |
43 | // A copyable object representing the result of a test part (i.e. an
44 | // assertion or an explicit FAIL(), ADD_FAILURE(), or SUCCESS()).
45 | //
46 | // Don't inherit from TestPartResult as its destructor is not virtual.
47 | class GTEST_API_ TestPartResult {
48 | public:
49 | // The possible outcomes of a test part (i.e. an assertion or an
50 | // explicit SUCCEED(), FAIL(), or ADD_FAILURE()).
51 | enum Type {
52 | kSuccess, // Succeeded.
53 | kNonFatalFailure, // Failed but the test can continue.
54 | kFatalFailure // Failed and the test should be terminated.
55 | };
56 |
57 | // C'tor. TestPartResult does NOT have a default constructor.
58 | // Always use this constructor (with parameters) to create a
59 | // TestPartResult object.
60 | TestPartResult(Type a_type,
61 | const char* a_file_name,
62 | int a_line_number,
63 | const char* a_message)
64 | : type_(a_type),
65 | file_name_(a_file_name == NULL ? "" : a_file_name),
66 | line_number_(a_line_number),
67 | summary_(ExtractSummary(a_message)),
68 | message_(a_message) {
69 | }
70 |
71 | // Gets the outcome of the test part.
72 | Type type() const { return type_; }
73 |
74 | // Gets the name of the source file where the test part took place, or
75 | // NULL if it's unknown.
76 | const char* file_name() const {
77 | return file_name_.empty() ? NULL : file_name_.c_str();
78 | }
79 |
80 | // Gets the line in the source file where the test part took place,
81 | // or -1 if it's unknown.
82 | int line_number() const { return line_number_; }
83 |
84 | // Gets the summary of the failure message.
85 | const char* summary() const { return summary_.c_str(); }
86 |
87 | // Gets the message associated with the test part.
88 | const char* message() const { return message_.c_str(); }
89 |
90 | // Returns true iff the test part passed.
91 | bool passed() const { return type_ == kSuccess; }
92 |
93 | // Returns true iff the test part failed.
94 | bool failed() const { return type_ != kSuccess; }
95 |
96 | // Returns true iff the test part non-fatally failed.
97 | bool nonfatally_failed() const { return type_ == kNonFatalFailure; }
98 |
99 | // Returns true iff the test part fatally failed.
100 | bool fatally_failed() const { return type_ == kFatalFailure; }
101 |
102 | private:
103 | Type type_;
104 |
105 | // Gets the summary of the failure message by omitting the stack
106 | // trace in it.
107 | static std::string ExtractSummary(const char* message);
108 |
109 | // The name of the source file where the test part took place, or
110 | // "" if the source file is unknown.
111 | std::string file_name_;
112 | // The line in the source file where the test part took place, or -1
113 | // if the line number is unknown.
114 | int line_number_;
115 | std::string summary_; // The test failure summary.
116 | std::string message_; // The test failure message.
117 | };
118 |
119 | // Prints a TestPartResult object.
120 | std::ostream& operator<<(std::ostream& os, const TestPartResult& result);
121 |
122 | // An array of TestPartResult objects.
123 | //
124 | // Don't inherit from TestPartResultArray as its destructor is not
125 | // virtual.
126 | class GTEST_API_ TestPartResultArray {
127 | public:
128 | TestPartResultArray() {}
129 |
130 | // Appends the given TestPartResult to the array.
131 | void Append(const TestPartResult& result);
132 |
133 | // Returns the TestPartResult at the given index (0-based).
134 | const TestPartResult& GetTestPartResult(int index) const;
135 |
136 | // Returns the number of TestPartResult objects in the array.
137 | int size() const;
138 |
139 | private:
140 | std::vector array_;
141 |
142 | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestPartResultArray);
143 | };
144 |
145 | // This interface knows how to report a test part result.
146 | class TestPartResultReporterInterface {
147 | public:
148 | virtual ~TestPartResultReporterInterface() {}
149 |
150 | virtual void ReportTestPartResult(const TestPartResult& result) = 0;
151 | };
152 |
153 | namespace internal {
154 |
155 | // This helper class is used by {ASSERT|EXPECT}_NO_FATAL_FAILURE to check if a
156 | // statement generates new fatal failures. To do so it registers itself as the
157 | // current test part result reporter. Besides checking if fatal failures were
158 | // reported, it only delegates the reporting to the former result reporter.
159 | // The original result reporter is restored in the destructor.
160 | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
161 | class GTEST_API_ HasNewFatalFailureHelper
162 | : public TestPartResultReporterInterface {
163 | public:
164 | HasNewFatalFailureHelper();
165 | virtual ~HasNewFatalFailureHelper();
166 | virtual void ReportTestPartResult(const TestPartResult& result);
167 | bool has_new_fatal_failure() const { return has_new_fatal_failure_; }
168 | private:
169 | bool has_new_fatal_failure_;
170 | TestPartResultReporterInterface* original_reporter_;
171 |
172 | GTEST_DISALLOW_COPY_AND_ASSIGN_(HasNewFatalFailureHelper);
173 | };
174 |
175 | } // namespace internal
176 |
177 | } // namespace testing
178 |
179 | #endif // GTEST_INCLUDE_GTEST_GTEST_TEST_PART_H_
180 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-string.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 | // Authors: wan@google.com (Zhanyong Wan), eefacm@gmail.com (Sean Mcafee)
31 | //
32 | // The Google C++ Testing Framework (Google Test)
33 | //
34 | // This header file declares the String class and functions used internally by
35 | // Google Test. They are subject to change without notice. They should not used
36 | // by code external to Google Test.
37 | //
38 | // This header file is #included by .
39 | // It should not be #included by other files.
40 |
41 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
42 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
43 |
44 | #ifdef __BORLANDC__
45 | // string.h is not guaranteed to provide strcpy on C++ Builder.
46 | # include
47 | #endif
48 |
49 | #include
50 | #include
51 |
52 | #include "gtest/internal/gtest-port.h"
53 |
54 | namespace testing {
55 | namespace internal {
56 |
57 | // String - an abstract class holding static string utilities.
58 | class GTEST_API_ String {
59 | public:
60 | // Static utility methods
61 |
62 | // Clones a 0-terminated C string, allocating memory using new. The
63 | // caller is responsible for deleting the return value using
64 | // delete[]. Returns the cloned string, or NULL if the input is
65 | // NULL.
66 | //
67 | // This is different from strdup() in string.h, which allocates
68 | // memory using malloc().
69 | static const char* CloneCString(const char* c_str);
70 |
71 | #if GTEST_OS_WINDOWS_MOBILE
72 | // Windows CE does not have the 'ANSI' versions of Win32 APIs. To be
73 | // able to pass strings to Win32 APIs on CE we need to convert them
74 | // to 'Unicode', UTF-16.
75 |
76 | // Creates a UTF-16 wide string from the given ANSI string, allocating
77 | // memory using new. The caller is responsible for deleting the return
78 | // value using delete[]. Returns the wide string, or NULL if the
79 | // input is NULL.
80 | //
81 | // The wide string is created using the ANSI codepage (CP_ACP) to
82 | // match the behaviour of the ANSI versions of Win32 calls and the
83 | // C runtime.
84 | static LPCWSTR AnsiToUtf16(const char* c_str);
85 |
86 | // Creates an ANSI string from the given wide string, allocating
87 | // memory using new. The caller is responsible for deleting the return
88 | // value using delete[]. Returns the ANSI string, or NULL if the
89 | // input is NULL.
90 | //
91 | // The returned string is created using the ANSI codepage (CP_ACP) to
92 | // match the behaviour of the ANSI versions of Win32 calls and the
93 | // C runtime.
94 | static const char* Utf16ToAnsi(LPCWSTR utf16_str);
95 | #endif
96 |
97 | // Compares two C strings. Returns true iff they have the same content.
98 | //
99 | // Unlike strcmp(), this function can handle NULL argument(s). A
100 | // NULL C string is considered different to any non-NULL C string,
101 | // including the empty string.
102 | static bool CStringEquals(const char* lhs, const char* rhs);
103 |
104 | // Converts a wide C string to a String using the UTF-8 encoding.
105 | // NULL will be converted to "(null)". If an error occurred during
106 | // the conversion, "(failed to convert from wide string)" is
107 | // returned.
108 | static std::string ShowWideCString(const wchar_t* wide_c_str);
109 |
110 | // Compares two wide C strings. Returns true iff they have the same
111 | // content.
112 | //
113 | // Unlike wcscmp(), this function can handle NULL argument(s). A
114 | // NULL C string is considered different to any non-NULL C string,
115 | // including the empty string.
116 | static bool WideCStringEquals(const wchar_t* lhs, const wchar_t* rhs);
117 |
118 | // Compares two C strings, ignoring case. Returns true iff they
119 | // have the same content.
120 | //
121 | // Unlike strcasecmp(), this function can handle NULL argument(s).
122 | // A NULL C string is considered different to any non-NULL C string,
123 | // including the empty string.
124 | static bool CaseInsensitiveCStringEquals(const char* lhs,
125 | const char* rhs);
126 |
127 | // Compares two wide C strings, ignoring case. Returns true iff they
128 | // have the same content.
129 | //
130 | // Unlike wcscasecmp(), this function can handle NULL argument(s).
131 | // A NULL C string is considered different to any non-NULL wide C string,
132 | // including the empty string.
133 | // NB: The implementations on different platforms slightly differ.
134 | // On windows, this method uses _wcsicmp which compares according to LC_CTYPE
135 | // environment variable. On GNU platform this method uses wcscasecmp
136 | // which compares according to LC_CTYPE category of the current locale.
137 | // On MacOS X, it uses towlower, which also uses LC_CTYPE category of the
138 | // current locale.
139 | static bool CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
140 | const wchar_t* rhs);
141 |
142 | // Returns true iff the given string ends with the given suffix, ignoring
143 | // case. Any string is considered to end with an empty suffix.
144 | static bool EndsWithCaseInsensitive(
145 | const std::string& str, const std::string& suffix);
146 |
147 | // Formats an int value as "%02d".
148 | static std::string FormatIntWidth2(int value); // "%02d" for width == 2
149 |
150 | // Formats an int value as "%X".
151 | static std::string FormatHexInt(int value);
152 |
153 | // Formats a byte as "%02X".
154 | static std::string FormatByte(unsigned char value);
155 |
156 | private:
157 | String(); // Not meant to be instantiated.
158 | }; // class String
159 |
160 | // Gets the content of the stringstream's buffer as an std::string. Each '\0'
161 | // character in the buffer is replaced with "\\0".
162 | GTEST_API_ std::string StringStreamToString(::std::stringstream* stream);
163 |
164 | } // namespace internal
165 | } // namespace testing
166 |
167 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_STRING_H_
168 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-linked_ptr.h:
--------------------------------------------------------------------------------
1 | // Copyright 2003 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 | // Authors: Dan Egnor (egnor@google.com)
31 | //
32 | // A "smart" pointer type with reference tracking. Every pointer to a
33 | // particular object is kept on a circular linked list. When the last pointer
34 | // to an object is destroyed or reassigned, the object is deleted.
35 | //
36 | // Used properly, this deletes the object when the last reference goes away.
37 | // There are several caveats:
38 | // - Like all reference counting schemes, cycles lead to leaks.
39 | // - Each smart pointer is actually two pointers (8 bytes instead of 4).
40 | // - Every time a pointer is assigned, the entire list of pointers to that
41 | // object is traversed. This class is therefore NOT SUITABLE when there
42 | // will often be more than two or three pointers to a particular object.
43 | // - References are only tracked as long as linked_ptr<> objects are copied.
44 | // If a linked_ptr<> is converted to a raw pointer and back, BAD THINGS
45 | // will happen (double deletion).
46 | //
47 | // A good use of this class is storing object references in STL containers.
48 | // You can safely put linked_ptr<> in a vector<>.
49 | // Other uses may not be as good.
50 | //
51 | // Note: If you use an incomplete type with linked_ptr<>, the class
52 | // *containing* linked_ptr<> must have a constructor and destructor (even
53 | // if they do nothing!).
54 | //
55 | // Bill Gibbons suggested we use something like this.
56 | //
57 | // Thread Safety:
58 | // Unlike other linked_ptr implementations, in this implementation
59 | // a linked_ptr object is thread-safe in the sense that:
60 | // - it's safe to copy linked_ptr objects concurrently,
61 | // - it's safe to copy *from* a linked_ptr and read its underlying
62 | // raw pointer (e.g. via get()) concurrently, and
63 | // - it's safe to write to two linked_ptrs that point to the same
64 | // shared object concurrently.
65 | // TODO(wan@google.com): rename this to safe_linked_ptr to avoid
66 | // confusion with normal linked_ptr.
67 |
68 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
69 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
70 |
71 | #include
72 | #include
73 |
74 | #include "gtest/internal/gtest-port.h"
75 |
76 | namespace testing {
77 | namespace internal {
78 |
79 | // Protects copying of all linked_ptr objects.
80 | GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_linked_ptr_mutex);
81 |
82 | // This is used internally by all instances of linked_ptr<>. It needs to be
83 | // a non-template class because different types of linked_ptr<> can refer to
84 | // the same object (linked_ptr(obj) vs linked_ptr(obj)).
85 | // So, it needs to be possible for different types of linked_ptr to participate
86 | // in the same circular linked list, so we need a single class type here.
87 | //
88 | // DO NOT USE THIS CLASS DIRECTLY YOURSELF. Use linked_ptr.
89 | class linked_ptr_internal {
90 | public:
91 | // Create a new circle that includes only this instance.
92 | void join_new() {
93 | next_ = this;
94 | }
95 |
96 | // Many linked_ptr operations may change p.link_ for some linked_ptr
97 | // variable p in the same circle as this object. Therefore we need
98 | // to prevent two such operations from occurring concurrently.
99 | //
100 | // Note that different types of linked_ptr objects can coexist in a
101 | // circle (e.g. linked_ptr, linked_ptr, and
102 | // linked_ptr). Therefore we must use a single mutex to
103 | // protect all linked_ptr objects. This can create serious
104 | // contention in production code, but is acceptable in a testing
105 | // framework.
106 |
107 | // Join an existing circle.
108 | void join(linked_ptr_internal const* ptr)
109 | GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
110 | MutexLock lock(&g_linked_ptr_mutex);
111 |
112 | linked_ptr_internal const* p = ptr;
113 | while (p->next_ != ptr) {
114 | assert(p->next_ != this &&
115 | "Trying to join() a linked ring we are already in. "
116 | "Is GMock thread safety enabled?");
117 | p = p->next_;
118 | }
119 | p->next_ = this;
120 | next_ = ptr;
121 | }
122 |
123 | // Leave whatever circle we're part of. Returns true if we were the
124 | // last member of the circle. Once this is done, you can join() another.
125 | bool depart()
126 | GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex) {
127 | MutexLock lock(&g_linked_ptr_mutex);
128 |
129 | if (next_ == this) return true;
130 | linked_ptr_internal const* p = next_;
131 | while (p->next_ != this) {
132 | assert(p->next_ != next_ &&
133 | "Trying to depart() a linked ring we are not in. "
134 | "Is GMock thread safety enabled?");
135 | p = p->next_;
136 | }
137 | p->next_ = next_;
138 | return false;
139 | }
140 |
141 | private:
142 | mutable linked_ptr_internal const* next_;
143 | };
144 |
145 | template
146 | class linked_ptr {
147 | public:
148 | typedef T element_type;
149 |
150 | // Take over ownership of a raw pointer. This should happen as soon as
151 | // possible after the object is created.
152 | explicit linked_ptr(T* ptr = NULL) { capture(ptr); }
153 | ~linked_ptr() { depart(); }
154 |
155 | // Copy an existing linked_ptr<>, adding ourselves to the list of references.
156 | template linked_ptr(linked_ptr const& ptr) { copy(&ptr); }
157 | linked_ptr(linked_ptr const& ptr) { // NOLINT
158 | assert(&ptr != this);
159 | copy(&ptr);
160 | }
161 |
162 | // Assignment releases the old value and acquires the new.
163 | template linked_ptr& operator=(linked_ptr const& ptr) {
164 | depart();
165 | copy(&ptr);
166 | return *this;
167 | }
168 |
169 | linked_ptr& operator=(linked_ptr const& ptr) {
170 | if (&ptr != this) {
171 | depart();
172 | copy(&ptr);
173 | }
174 | return *this;
175 | }
176 |
177 | // Smart pointer members.
178 | void reset(T* ptr = NULL) {
179 | depart();
180 | capture(ptr);
181 | }
182 | T* get() const { return value_; }
183 | T* operator->() const { return value_; }
184 | T& operator*() const { return *value_; }
185 |
186 | bool operator==(T* p) const { return value_ == p; }
187 | bool operator!=(T* p) const { return value_ != p; }
188 | template
189 | bool operator==(linked_ptr const& ptr) const {
190 | return value_ == ptr.get();
191 | }
192 | template
193 | bool operator!=(linked_ptr const& ptr) const {
194 | return value_ != ptr.get();
195 | }
196 |
197 | private:
198 | template
199 | friend class linked_ptr;
200 |
201 | T* value_;
202 | linked_ptr_internal link_;
203 |
204 | void depart() {
205 | if (link_.depart()) delete value_;
206 | }
207 |
208 | void capture(T* ptr) {
209 | value_ = ptr;
210 | link_.join_new();
211 | }
212 |
213 | template void copy(linked_ptr const* ptr) {
214 | value_ = ptr->get();
215 | if (value_)
216 | link_.join(&ptr->link_);
217 | else
218 | link_.join_new();
219 | }
220 | };
221 |
222 | template inline
223 | bool operator==(T* ptr, const linked_ptr& x) {
224 | return ptr == x.get();
225 | }
226 |
227 | template inline
228 | bool operator!=(T* ptr, const linked_ptr& x) {
229 | return ptr != x.get();
230 | }
231 |
232 | // A function to convert T* into linked_ptr
233 | // Doing e.g. make_linked_ptr(new FooBarBaz(arg)) is a shorter notation
234 | // for linked_ptr >(new FooBarBaz(arg))
235 | template
236 | linked_ptr make_linked_ptr(T* ptr) {
237 | return linked_ptr(ptr);
238 | }
239 |
240 | } // namespace internal
241 | } // namespace testing
242 |
243 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_
244 |
--------------------------------------------------------------------------------
/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
50 |
51 | #include "gtest/internal/gtest-port.h"
52 |
53 | // Ensures that there is at least one operator<< in the global namespace.
54 | // See Message& operator<<(...) below for why.
55 | void operator<<(const testing::internal::Secret&, int);
56 |
57 | namespace testing {
58 |
59 | // The Message class works like an ostream repeater.
60 | //
61 | // Typical usage:
62 | //
63 | // 1. You stream a bunch of values to a Message object.
64 | // It will remember the text in a stringstream.
65 | // 2. Then you stream the Message object to an ostream.
66 | // This causes the text in the Message to be streamed
67 | // to the ostream.
68 | //
69 | // For example;
70 | //
71 | // testing::Message foo;
72 | // foo << 1 << " != " << 2;
73 | // std::cout << foo;
74 | //
75 | // will print "1 != 2".
76 | //
77 | // Message is not intended to be inherited from. In particular, its
78 | // destructor is not virtual.
79 | //
80 | // Note that stringstream behaves differently in gcc and in MSVC. You
81 | // can stream a NULL char pointer to it in the former, but not in the
82 | // latter (it causes an access violation if you do). The Message
83 | // class hides this difference by treating a NULL char pointer as
84 | // "(null)".
85 | class GTEST_API_ Message {
86 | private:
87 | // The type of basic IO manipulators (endl, ends, and flush) for
88 | // narrow streams.
89 | typedef std::ostream& (*BasicNarrowIoManip)(std::ostream&);
90 |
91 | public:
92 | // Constructs an empty Message.
93 | Message();
94 |
95 | // Copy constructor.
96 | Message(const Message& msg) : ss_(new ::std::stringstream) { // NOLINT
97 | *ss_ << msg.GetString();
98 | }
99 |
100 | // Constructs a Message from a C-string.
101 | explicit Message(const char* str) : ss_(new ::std::stringstream) {
102 | *ss_ << str;
103 | }
104 |
105 | #if GTEST_OS_SYMBIAN
106 | // Streams a value (either a pointer or not) to this object.
107 | template
108 | inline Message& operator <<(const T& value) {
109 | StreamHelper(typename internal::is_pointer::type(), value);
110 | return *this;
111 | }
112 | #else
113 | // Streams a non-pointer value to this object.
114 | template
115 | inline Message& operator <<(const T& val) {
116 | // Some libraries overload << for STL containers. These
117 | // overloads are defined in the global namespace instead of ::std.
118 | //
119 | // C++'s symbol lookup rule (i.e. Koenig lookup) says that these
120 | // overloads are visible in either the std namespace or the global
121 | // namespace, but not other namespaces, including the testing
122 | // namespace which Google Test's Message class is in.
123 | //
124 | // To allow STL containers (and other types that has a << operator
125 | // defined in the global namespace) to be used in Google Test
126 | // assertions, testing::Message must access the custom << operator
127 | // from the global namespace. With this using declaration,
128 | // overloads of << defined in the global namespace and those
129 | // visible via Koenig lookup are both exposed in this function.
130 | using ::operator <<;
131 | *ss_ << val;
132 | return *this;
133 | }
134 |
135 | // Streams a pointer value to this object.
136 | //
137 | // This function is an overload of the previous one. When you
138 | // stream a pointer to a Message, this definition will be used as it
139 | // is more specialized. (The C++ Standard, section
140 | // [temp.func.order].) If you stream a non-pointer, then the
141 | // previous definition will be used.
142 | //
143 | // The reason for this overload is that streaming a NULL pointer to
144 | // ostream is undefined behavior. Depending on the compiler, you
145 | // may get "0", "(nil)", "(null)", or an access violation. To
146 | // ensure consistent result across compilers, we always treat NULL
147 | // as "(null)".
148 | template
149 | inline Message& operator <<(T* const& pointer) { // NOLINT
150 | if (pointer == NULL) {
151 | *ss_ << "(null)";
152 | } else {
153 | *ss_ << pointer;
154 | }
155 | return *this;
156 | }
157 | #endif // GTEST_OS_SYMBIAN
158 |
159 | // Since the basic IO manipulators are overloaded for both narrow
160 | // and wide streams, we have to provide this specialized definition
161 | // of operator <<, even though its body is the same as the
162 | // templatized version above. Without this definition, streaming
163 | // endl or other basic IO manipulators to Message will confuse the
164 | // compiler.
165 | Message& operator <<(BasicNarrowIoManip val) {
166 | *ss_ << val;
167 | return *this;
168 | }
169 |
170 | // Instead of 1/0, we want to see true/false for bool values.
171 | Message& operator <<(bool b) {
172 | return *this << (b ? "true" : "false");
173 | }
174 |
175 | // These two overloads allow streaming a wide C string to a Message
176 | // using the UTF-8 encoding.
177 | Message& operator <<(const wchar_t* wide_c_str);
178 | Message& operator <<(wchar_t* wide_c_str);
179 |
180 | #if GTEST_HAS_STD_WSTRING
181 | // Converts the given wide string to a narrow string using the UTF-8
182 | // encoding, and streams the result to this Message object.
183 | Message& operator <<(const ::std::wstring& wstr);
184 | #endif // GTEST_HAS_STD_WSTRING
185 |
186 | #if GTEST_HAS_GLOBAL_WSTRING
187 | // Converts the given wide string to a narrow string using the UTF-8
188 | // encoding, and streams the result to this Message object.
189 | Message& operator <<(const ::wstring& wstr);
190 | #endif // GTEST_HAS_GLOBAL_WSTRING
191 |
192 | // Gets the text streamed to this object so far as an std::string.
193 | // Each '\0' character in the buffer is replaced with "\\0".
194 | //
195 | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
196 | std::string GetString() const;
197 |
198 | private:
199 |
200 | #if GTEST_OS_SYMBIAN
201 | // These are needed as the Nokia Symbian Compiler cannot decide between
202 | // const T& and const T* in a function template. The Nokia compiler _can_
203 | // decide between class template specializations for T and T*, so a
204 | // tr1::type_traits-like is_pointer works, and we can overload on that.
205 | template
206 | inline void StreamHelper(internal::true_type /*is_pointer*/, T* pointer) {
207 | if (pointer == NULL) {
208 | *ss_ << "(null)";
209 | } else {
210 | *ss_ << pointer;
211 | }
212 | }
213 | template
214 | inline void StreamHelper(internal::false_type /*is_pointer*/,
215 | const T& value) {
216 | // See the comments in Message& operator <<(const T&) above for why
217 | // we need this using statement.
218 | using ::operator <<;
219 | *ss_ << value;
220 | }
221 | #endif // GTEST_OS_SYMBIAN
222 |
223 | // We'll hold the text streamed to this object here.
224 | const internal::scoped_ptr< ::std::stringstream> ss_;
225 |
226 | // We declare (but don't implement) this to prevent the compiler
227 | // from implementing the assignment operator.
228 | void operator=(const Message&);
229 | };
230 |
231 | // Streams a Message to an ostream.
232 | inline std::ostream& operator <<(std::ostream& os, const Message& sb) {
233 | return os << sb.GetString();
234 | }
235 |
236 | namespace internal {
237 |
238 | // Converts a streamable value to an std::string. A NULL pointer is
239 | // converted to "(null)". When the input value is a ::string,
240 | // ::std::string, ::wstring, or ::std::wstring object, each NUL
241 | // character in it is replaced with "\\0".
242 | template
243 | std::string StreamableToString(const T& streamable) {
244 | return (Message() << streamable).GetString();
245 | }
246 |
247 | } // namespace internal
248 | } // namespace testing
249 |
250 | #endif // GTEST_INCLUDE_GTEST_GTEST_MESSAGE_H_
251 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-filepath.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: keith.ray@gmail.com (Keith Ray)
31 | //
32 | // Google Test filepath utilities
33 | //
34 | // This header file declares classes and functions used internally by
35 | // Google Test. They are subject to change without notice.
36 | //
37 | // This file is #included in .
38 | // Do not include this header file separately!
39 |
40 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
41 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
42 |
43 | #include "gtest/internal/gtest-string.h"
44 |
45 | namespace testing {
46 | namespace internal {
47 |
48 | // FilePath - a class for file and directory pathname manipulation which
49 | // handles platform-specific conventions (like the pathname separator).
50 | // Used for helper functions for naming files in a directory for xml output.
51 | // Except for Set methods, all methods are const or static, which provides an
52 | // "immutable value object" -- useful for peace of mind.
53 | // A FilePath with a value ending in a path separator ("like/this/") represents
54 | // a directory, otherwise it is assumed to represent a file. In either case,
55 | // it may or may not represent an actual file or directory in the file system.
56 | // Names are NOT checked for syntax correctness -- no checking for illegal
57 | // characters, malformed paths, etc.
58 |
59 | class GTEST_API_ FilePath {
60 | public:
61 | FilePath() : pathname_("") { }
62 | FilePath(const FilePath& rhs) : pathname_(rhs.pathname_) { }
63 |
64 | explicit FilePath(const std::string& pathname) : pathname_(pathname) {
65 | Normalize();
66 | }
67 |
68 | FilePath& operator=(const FilePath& rhs) {
69 | Set(rhs);
70 | return *this;
71 | }
72 |
73 | void Set(const FilePath& rhs) {
74 | pathname_ = rhs.pathname_;
75 | }
76 |
77 | const std::string& string() const { return pathname_; }
78 | const char* c_str() const { return pathname_.c_str(); }
79 |
80 | // Returns the current working directory, or "" if unsuccessful.
81 | static FilePath GetCurrentDir();
82 |
83 | // Given directory = "dir", base_name = "test", number = 0,
84 | // extension = "xml", returns "dir/test.xml". If number is greater
85 | // than zero (e.g., 12), returns "dir/test_12.xml".
86 | // On Windows platform, uses \ as the separator rather than /.
87 | static FilePath MakeFileName(const FilePath& directory,
88 | const FilePath& base_name,
89 | int number,
90 | const char* extension);
91 |
92 | // Given directory = "dir", relative_path = "test.xml",
93 | // returns "dir/test.xml".
94 | // On Windows, uses \ as the separator rather than /.
95 | static FilePath ConcatPaths(const FilePath& directory,
96 | const FilePath& relative_path);
97 |
98 | // Returns a pathname for a file that does not currently exist. The pathname
99 | // will be directory/base_name.extension or
100 | // directory/base_name_.extension if directory/base_name.extension
101 | // already exists. The number will be incremented until a pathname is found
102 | // that does not already exist.
103 | // Examples: 'dir/foo_test.xml' or 'dir/foo_test_1.xml'.
104 | // There could be a race condition if two or more processes are calling this
105 | // function at the same time -- they could both pick the same filename.
106 | static FilePath GenerateUniqueFileName(const FilePath& directory,
107 | const FilePath& base_name,
108 | const char* extension);
109 |
110 | // Returns true iff the path is "".
111 | bool IsEmpty() const { return pathname_.empty(); }
112 |
113 | // If input name has a trailing separator character, removes it and returns
114 | // the name, otherwise return the name string unmodified.
115 | // On Windows platform, uses \ as the separator, other platforms use /.
116 | FilePath RemoveTrailingPathSeparator() const;
117 |
118 | // Returns a copy of the FilePath with the directory part removed.
119 | // Example: FilePath("path/to/file").RemoveDirectoryName() returns
120 | // FilePath("file"). If there is no directory part ("just_a_file"), it returns
121 | // the FilePath unmodified. If there is no file part ("just_a_dir/") it
122 | // returns an empty FilePath ("").
123 | // On Windows platform, '\' is the path separator, otherwise it is '/'.
124 | FilePath RemoveDirectoryName() const;
125 |
126 | // RemoveFileName returns the directory path with the filename removed.
127 | // Example: FilePath("path/to/file").RemoveFileName() returns "path/to/".
128 | // If the FilePath is "a_file" or "/a_file", RemoveFileName returns
129 | // FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does
130 | // not have a file, like "just/a/dir/", it returns the FilePath unmodified.
131 | // On Windows platform, '\' is the path separator, otherwise it is '/'.
132 | FilePath RemoveFileName() const;
133 |
134 | // Returns a copy of the FilePath with the case-insensitive extension removed.
135 | // Example: FilePath("dir/file.exe").RemoveExtension("EXE") returns
136 | // FilePath("dir/file"). If a case-insensitive extension is not
137 | // found, returns a copy of the original FilePath.
138 | FilePath RemoveExtension(const char* extension) const;
139 |
140 | // Creates directories so that path exists. Returns true if successful or if
141 | // the directories already exist; returns false if unable to create
142 | // directories for any reason. Will also return false if the FilePath does
143 | // not represent a directory (that is, it doesn't end with a path separator).
144 | bool CreateDirectoriesRecursively() const;
145 |
146 | // Create the directory so that path exists. Returns true if successful or
147 | // if the directory already exists; returns false if unable to create the
148 | // directory for any reason, including if the parent directory does not
149 | // exist. Not named "CreateDirectory" because that's a macro on Windows.
150 | bool CreateFolder() const;
151 |
152 | // Returns true if FilePath describes something in the file-system,
153 | // either a file, directory, or whatever, and that something exists.
154 | bool FileOrDirectoryExists() const;
155 |
156 | // Returns true if pathname describes a directory in the file-system
157 | // that exists.
158 | bool DirectoryExists() const;
159 |
160 | // Returns true if FilePath ends with a path separator, which indicates that
161 | // it is intended to represent a directory. Returns false otherwise.
162 | // This does NOT check that a directory (or file) actually exists.
163 | bool IsDirectory() const;
164 |
165 | // Returns true if pathname describes a root directory. (Windows has one
166 | // root directory per disk drive.)
167 | bool IsRootDirectory() const;
168 |
169 | // Returns true if pathname describes an absolute path.
170 | bool IsAbsolutePath() const;
171 |
172 | private:
173 | // Replaces multiple consecutive separators with a single separator.
174 | // For example, "bar///foo" becomes "bar/foo". Does not eliminate other
175 | // redundancies that might be in a pathname involving "." or "..".
176 | //
177 | // A pathname with multiple consecutive separators may occur either through
178 | // user error or as a result of some scripts or APIs that generate a pathname
179 | // with a trailing separator. On other platforms the same API or script
180 | // may NOT generate a pathname with a trailing "/". Then elsewhere that
181 | // pathname may have another "/" and pathname components added to it,
182 | // without checking for the separator already being there.
183 | // The script language and operating system may allow paths like "foo//bar"
184 | // but some of the functions in FilePath will not handle that correctly. In
185 | // particular, RemoveTrailingPathSeparator() only removes one separator, and
186 | // it is called in CreateDirectoriesRecursively() assuming that it will change
187 | // a pathname from directory syntax (trailing separator) to filename syntax.
188 | //
189 | // On Windows this method also replaces the alternate path separator '/' with
190 | // the primary path separator '\\', so that for example "bar\\/\\foo" becomes
191 | // "bar\\foo".
192 |
193 | void Normalize();
194 |
195 | // Returns a pointer to the last occurence of a valid path separator in
196 | // the FilePath. On Windows, for example, both '/' and '\' are valid path
197 | // separators. Returns NULL if no path separator was found.
198 | const char* FindLastPathSeparator() const;
199 |
200 | std::string pathname_;
201 | }; // class FilePath
202 |
203 | } // namespace internal
204 | } // namespace testing
205 |
206 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_FILEPATH_H_
207 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-param-util-generated.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $var n = 50 $$ Maximum length of Values arguments we want to support.
3 | $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
4 | // Copyright 2008 Google Inc.
5 | // All Rights Reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions are
9 | // met:
10 | //
11 | // * Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | // * Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following disclaimer
15 | // in the documentation and/or other materials provided with the
16 | // distribution.
17 | // * Neither the name of Google Inc. nor the names of its
18 | // contributors may be used to endorse or promote products derived from
19 | // this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | //
33 | // Author: vladl@google.com (Vlad Losev)
34 |
35 | // Type and function utilities for implementing parameterized tests.
36 | // This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
37 | //
38 | // Currently Google Test supports at most $n arguments in Values,
39 | // and at most $maxtuple arguments in Combine. Please contact
40 | // googletestframework@googlegroups.com if you need more.
41 | // Please note that the number of arguments to Combine is limited
42 | // by the maximum arity of the implementation of tuple which is
43 | // currently set at $maxtuple.
44 |
45 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
46 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
47 |
48 | // scripts/fuse_gtest.py depends on gtest's own header being #included
49 | // *unconditionally*. Therefore these #includes cannot be moved
50 | // inside #if GTEST_HAS_PARAM_TEST.
51 | #include "gtest/internal/gtest-param-util.h"
52 | #include "gtest/internal/gtest-port.h"
53 |
54 | #if GTEST_HAS_PARAM_TEST
55 |
56 | namespace testing {
57 |
58 | // Forward declarations of ValuesIn(), which is implemented in
59 | // include/gtest/gtest-param-test.h.
60 | template
61 | internal::ParamGenerator<
62 | typename ::testing::internal::IteratorTraits::value_type>
63 | ValuesIn(ForwardIterator begin, ForwardIterator end);
64 |
65 | template
66 | internal::ParamGenerator ValuesIn(const T (&array)[N]);
67 |
68 | template
69 | internal::ParamGenerator ValuesIn(
70 | const Container& container);
71 |
72 | namespace internal {
73 |
74 | // Used in the Values() function to provide polymorphic capabilities.
75 | $range i 1..n
76 | $for i [[
77 | $range j 1..i
78 |
79 | template <$for j, [[typename T$j]]>
80 | class ValueArray$i {
81 | public:
82 | $if i==1 [[explicit ]]ValueArray$i($for j, [[T$j v$j]]) : $for j, [[v$(j)_(v$j)]] {}
83 |
84 | template
85 | operator ParamGenerator() const {
86 | const T array[] = {$for j, [[static_cast(v$(j)_)]]};
87 | return ValuesIn(array);
88 | }
89 |
90 | private:
91 | // No implementation - assignment is unsupported.
92 | void operator=(const ValueArray$i& other);
93 |
94 | $for j [[
95 |
96 | const T$j v$(j)_;
97 | ]]
98 |
99 | };
100 |
101 | ]]
102 |
103 | # if GTEST_HAS_COMBINE
104 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
105 | //
106 | // Generates values from the Cartesian product of values produced
107 | // by the argument generators.
108 | //
109 | $range i 2..maxtuple
110 | $for i [[
111 | $range j 1..i
112 | $range k 2..i
113 |
114 | template <$for j, [[typename T$j]]>
115 | class CartesianProductGenerator$i
116 | : public ParamGeneratorInterface< ::testing::tuple<$for j, [[T$j]]> > {
117 | public:
118 | typedef ::testing::tuple<$for j, [[T$j]]> ParamType;
119 |
120 | CartesianProductGenerator$i($for j, [[const ParamGenerator& g$j]])
121 | : $for j, [[g$(j)_(g$j)]] {}
122 | virtual ~CartesianProductGenerator$i() {}
123 |
124 | virtual ParamIteratorInterface* Begin() const {
125 | return new Iterator(this, $for j, [[g$(j)_, g$(j)_.begin()]]);
126 | }
127 | virtual ParamIteratorInterface* End() const {
128 | return new Iterator(this, $for j, [[g$(j)_, g$(j)_.end()]]);
129 | }
130 |
131 | private:
132 | class Iterator : public ParamIteratorInterface {
133 | public:
134 | Iterator(const ParamGeneratorInterface* base, $for j, [[
135 |
136 | const ParamGenerator& g$j,
137 | const typename ParamGenerator::iterator& current$(j)]])
138 | : base_(base),
139 | $for j, [[
140 |
141 | begin$(j)_(g$j.begin()), end$(j)_(g$j.end()), current$(j)_(current$j)
142 | ]] {
143 | ComputeCurrentValue();
144 | }
145 | virtual ~Iterator() {}
146 |
147 | virtual const ParamGeneratorInterface* BaseGenerator() const {
148 | return base_;
149 | }
150 | // Advance should not be called on beyond-of-range iterators
151 | // so no component iterators must be beyond end of range, either.
152 | virtual void Advance() {
153 | assert(!AtEnd());
154 | ++current$(i)_;
155 |
156 | $for k [[
157 | if (current$(i+2-k)_ == end$(i+2-k)_) {
158 | current$(i+2-k)_ = begin$(i+2-k)_;
159 | ++current$(i+2-k-1)_;
160 | }
161 |
162 | ]]
163 | ComputeCurrentValue();
164 | }
165 | virtual ParamIteratorInterface* Clone() const {
166 | return new Iterator(*this);
167 | }
168 | virtual const ParamType* Current() const { return ¤t_value_; }
169 | virtual bool Equals(const ParamIteratorInterface& other) const {
170 | // Having the same base generator guarantees that the other
171 | // iterator is of the same type and we can downcast.
172 | GTEST_CHECK_(BaseGenerator() == other.BaseGenerator())
173 | << "The program attempted to compare iterators "
174 | << "from different generators." << std::endl;
175 | const Iterator* typed_other =
176 | CheckedDowncastToActualType(&other);
177 | // We must report iterators equal if they both point beyond their
178 | // respective ranges. That can happen in a variety of fashions,
179 | // so we have to consult AtEnd().
180 | return (AtEnd() && typed_other->AtEnd()) ||
181 | ($for j && [[
182 |
183 | current$(j)_ == typed_other->current$(j)_
184 | ]]);
185 | }
186 |
187 | private:
188 | Iterator(const Iterator& other)
189 | : base_(other.base_), $for j, [[
190 |
191 | begin$(j)_(other.begin$(j)_),
192 | end$(j)_(other.end$(j)_),
193 | current$(j)_(other.current$(j)_)
194 | ]] {
195 | ComputeCurrentValue();
196 | }
197 |
198 | void ComputeCurrentValue() {
199 | if (!AtEnd())
200 | current_value_ = ParamType($for j, [[*current$(j)_]]);
201 | }
202 | bool AtEnd() const {
203 | // We must report iterator past the end of the range when either of the
204 | // component iterators has reached the end of its range.
205 | return
206 | $for j || [[
207 |
208 | current$(j)_ == end$(j)_
209 | ]];
210 | }
211 |
212 | // No implementation - assignment is unsupported.
213 | void operator=(const Iterator& other);
214 |
215 | const ParamGeneratorInterface* const base_;
216 | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses.
217 | // current[i]_ is the actual traversing iterator.
218 | $for j [[
219 |
220 | const typename ParamGenerator::iterator begin$(j)_;
221 | const typename ParamGenerator::iterator end$(j)_;
222 | typename ParamGenerator::iterator current$(j)_;
223 | ]]
224 |
225 | ParamType current_value_;
226 | }; // class CartesianProductGenerator$i::Iterator
227 |
228 | // No implementation - assignment is unsupported.
229 | void operator=(const CartesianProductGenerator$i& other);
230 |
231 |
232 | $for j [[
233 | const ParamGenerator g$(j)_;
234 |
235 | ]]
236 | }; // class CartesianProductGenerator$i
237 |
238 |
239 | ]]
240 |
241 | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
242 | //
243 | // Helper classes providing Combine() with polymorphic features. They allow
244 | // casting CartesianProductGeneratorN to ParamGenerator if T is
245 | // convertible to U.
246 | //
247 | $range i 2..maxtuple
248 | $for i [[
249 | $range j 1..i
250 |
251 | template <$for j, [[class Generator$j]]>
252 | class CartesianProductHolder$i {
253 | public:
254 | CartesianProductHolder$i($for j, [[const Generator$j& g$j]])
255 | : $for j, [[g$(j)_(g$j)]] {}
256 | template <$for j, [[typename T$j]]>
257 | operator ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >() const {
258 | return ParamGenerator< ::testing::tuple<$for j, [[T$j]]> >(
259 | new CartesianProductGenerator$i<$for j, [[T$j]]>(
260 | $for j,[[
261 |
262 | static_cast >(g$(j)_)
263 | ]]));
264 | }
265 |
266 | private:
267 | // No implementation - assignment is unsupported.
268 | void operator=(const CartesianProductHolder$i& other);
269 |
270 |
271 | $for j [[
272 | const Generator$j g$(j)_;
273 |
274 | ]]
275 | }; // class CartesianProductHolder$i
276 |
277 | ]]
278 |
279 | # endif // GTEST_HAS_COMBINE
280 |
281 | } // namespace internal
282 | } // namespace testing
283 |
284 | #endif // GTEST_HAS_PARAM_TEST
285 |
286 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_
287 |
--------------------------------------------------------------------------------
/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-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/gtest/internal/gtest-type-util.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $var n = 50 $$ Maximum length of type lists we want to support.
3 | // Copyright 2008 Google Inc.
4 | // All Rights Reserved.
5 | //
6 | // Redistribution and use in source and binary forms, with or without
7 | // modification, are permitted provided that the following conditions are
8 | // met:
9 | //
10 | // * Redistributions of source code must retain the above copyright
11 | // notice, this list of conditions and the following disclaimer.
12 | // * Redistributions in binary form must reproduce the above
13 | // copyright notice, this list of conditions and the following disclaimer
14 | // in the documentation and/or other materials provided with the
15 | // distribution.
16 | // * Neither the name of Google Inc. nor the names of its
17 | // contributors may be used to endorse or promote products derived from
18 | // this software without specific prior written permission.
19 | //
20 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | //
32 | // Author: wan@google.com (Zhanyong Wan)
33 |
34 | // Type utilities needed for implementing typed and type-parameterized
35 | // tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
36 | //
37 | // Currently we support at most $n types in a list, and at most $n
38 | // type-parameterized tests in one type-parameterized test case.
39 | // Please contact googletestframework@googlegroups.com if you need
40 | // more.
41 |
42 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
43 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
44 |
45 | #include "gtest/internal/gtest-port.h"
46 |
47 | // #ifdef __GNUC__ is too general here. It is possible to use gcc without using
48 | // libstdc++ (which is where cxxabi.h comes from).
49 | # if GTEST_HAS_CXXABI_H_
50 | # include
51 | # elif defined(__HP_aCC)
52 | # include
53 | # endif // GTEST_HASH_CXXABI_H_
54 |
55 | namespace testing {
56 | namespace internal {
57 |
58 | // GetTypeName() returns a human-readable name of type T.
59 | // NB: This function is also used in Google Mock, so don't move it inside of
60 | // the typed-test-only section below.
61 | template
62 | std::string GetTypeName() {
63 | # if GTEST_HAS_RTTI
64 |
65 | const char* const name = typeid(T).name();
66 | # if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
67 | int status = 0;
68 | // gcc's implementation of typeid(T).name() mangles the type name,
69 | // so we have to demangle it.
70 | # if GTEST_HAS_CXXABI_H_
71 | using abi::__cxa_demangle;
72 | # endif // GTEST_HAS_CXXABI_H_
73 | char* const readable_name = __cxa_demangle(name, 0, 0, &status);
74 | const std::string name_str(status == 0 ? readable_name : name);
75 | free(readable_name);
76 | return name_str;
77 | # else
78 | return name;
79 | # endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
80 |
81 | # else
82 |
83 | return "";
84 |
85 | # endif // GTEST_HAS_RTTI
86 | }
87 |
88 | #if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
89 |
90 | // AssertyTypeEq::type is defined iff T1 and T2 are the same
91 | // type. This can be used as a compile-time assertion to ensure that
92 | // two types are equal.
93 |
94 | template
95 | struct AssertTypeEq;
96 |
97 | template
98 | struct AssertTypeEq {
99 | typedef bool type;
100 | };
101 |
102 | // A unique type used as the default value for the arguments of class
103 | // template Types. This allows us to simulate variadic templates
104 | // (e.g. Types, Type, and etc), which C++ doesn't
105 | // support directly.
106 | struct None {};
107 |
108 | // The following family of struct and struct templates are used to
109 | // represent type lists. In particular, TypesN
110 | // represents a type list with N types (T1, T2, ..., and TN) in it.
111 | // Except for Types0, every struct in the family has two member types:
112 | // Head for the first type in the list, and Tail for the rest of the
113 | // list.
114 |
115 | // The empty type list.
116 | struct Types0 {};
117 |
118 | // Type lists of length 1, 2, 3, and so on.
119 |
120 | template
121 | struct Types1 {
122 | typedef T1 Head;
123 | typedef Types0 Tail;
124 | };
125 |
126 | $range i 2..n
127 |
128 | $for i [[
129 | $range j 1..i
130 | $range k 2..i
131 | template <$for j, [[typename T$j]]>
132 | struct Types$i {
133 | typedef T1 Head;
134 | typedef Types$(i-1)<$for k, [[T$k]]> Tail;
135 | };
136 |
137 |
138 | ]]
139 |
140 | } // namespace internal
141 |
142 | // We don't want to require the users to write TypesN<...> directly,
143 | // as that would require them to count the length. Types<...> is much
144 | // easier to write, but generates horrible messages when there is a
145 | // compiler error, as gcc insists on printing out each template
146 | // argument, even if it has the default value (this means Types
147 | // will appear as Types in the compiler
148 | // errors).
149 | //
150 | // Our solution is to combine the best part of the two approaches: a
151 | // user would write Types, and Google Test will translate
152 | // that to TypesN internally to make error messages
153 | // readable. The translation is done by the 'type' member of the
154 | // Types template.
155 |
156 | $range i 1..n
157 | template <$for i, [[typename T$i = internal::None]]>
158 | struct Types {
159 | typedef internal::Types$n<$for i, [[T$i]]> type;
160 | };
161 |
162 | template <>
163 | struct Types<$for i, [[internal::None]]> {
164 | typedef internal::Types0 type;
165 | };
166 |
167 | $range i 1..n-1
168 | $for i [[
169 | $range j 1..i
170 | $range k i+1..n
171 | template <$for j, [[typename T$j]]>
172 | struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
173 | typedef internal::Types$i<$for j, [[T$j]]> type;
174 | };
175 |
176 | ]]
177 |
178 | namespace internal {
179 |
180 | # define GTEST_TEMPLATE_ template class
181 |
182 | // The template "selector" struct TemplateSel is used to
183 | // represent Tmpl, which must be a class template with one type
184 | // parameter, as a type. TemplateSel::Bind::type is defined
185 | // as the type Tmpl. This allows us to actually instantiate the
186 | // template "selected" by TemplateSel.
187 | //
188 | // This trick is necessary for simulating typedef for class templates,
189 | // which C++ doesn't support directly.
190 | template
191 | struct TemplateSel {
192 | template
193 | struct Bind {
194 | typedef Tmpl type;
195 | };
196 | };
197 |
198 | # define GTEST_BIND_(TmplSel, T) \
199 | TmplSel::template Bind::type
200 |
201 | // A unique struct template used as the default value for the
202 | // arguments of class template Templates. This allows us to simulate
203 | // variadic templates (e.g. Templates, Templates,
204 | // and etc), which C++ doesn't support directly.
205 | template
206 | struct NoneT {};
207 |
208 | // The following family of struct and struct templates are used to
209 | // represent template lists. In particular, TemplatesN represents a list of N templates (T1, T2, ..., and TN). Except
211 | // for Templates0, every struct in the family has two member types:
212 | // Head for the selector of the first template in the list, and Tail
213 | // for the rest of the list.
214 |
215 | // The empty template list.
216 | struct Templates0 {};
217 |
218 | // Template lists of length 1, 2, 3, and so on.
219 |
220 | template
221 | struct Templates1 {
222 | typedef TemplateSel Head;
223 | typedef Templates0 Tail;
224 | };
225 |
226 | $range i 2..n
227 |
228 | $for i [[
229 | $range j 1..i
230 | $range k 2..i
231 | template <$for j, [[GTEST_TEMPLATE_ T$j]]>
232 | struct Templates$i {
233 | typedef TemplateSel Head;
234 | typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
235 | };
236 |
237 |
238 | ]]
239 |
240 | // We don't want to require the users to write TemplatesN<...> directly,
241 | // as that would require them to count the length. Templates<...> is much
242 | // easier to write, but generates horrible messages when there is a
243 | // compiler error, as gcc insists on printing out each template
244 | // argument, even if it has the default value (this means Templates
245 | // will appear as Templates in the compiler
246 | // errors).
247 | //
248 | // Our solution is to combine the best part of the two approaches: a
249 | // user would write Templates, and Google Test will translate
250 | // that to TemplatesN internally to make error messages
251 | // readable. The translation is done by the 'type' member of the
252 | // Templates template.
253 |
254 | $range i 1..n
255 | template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
256 | struct Templates {
257 | typedef Templates$n<$for i, [[T$i]]> type;
258 | };
259 |
260 | template <>
261 | struct Templates<$for i, [[NoneT]]> {
262 | typedef Templates0 type;
263 | };
264 |
265 | $range i 1..n-1
266 | $for i [[
267 | $range j 1..i
268 | $range k i+1..n
269 | template <$for j, [[GTEST_TEMPLATE_ T$j]]>
270 | struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
271 | typedef Templates$i<$for j, [[T$j]]> type;
272 | };
273 |
274 | ]]
275 |
276 | // The TypeList template makes it possible to use either a single type
277 | // or a Types<...> list in TYPED_TEST_CASE() and
278 | // INSTANTIATE_TYPED_TEST_CASE_P().
279 |
280 | template
281 | struct TypeList {
282 | typedef Types1 type;
283 | };
284 |
285 |
286 | $range i 1..n
287 | template <$for i, [[typename T$i]]>
288 | struct TypeList > {
289 | typedef typename Types<$for i, [[T$i]]>::type type;
290 | };
291 |
292 | #endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
293 |
294 | } // namespace internal
295 | } // namespace testing
296 |
297 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
298 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/gtest-spi.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 | // Utilities for testing Google Test itself and code that uses Google Test
33 | // (e.g. frameworks built on top of Google Test).
34 |
35 | #ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
36 | #define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
37 |
38 | #include "gtest/gtest.h"
39 |
40 | namespace testing {
41 |
42 | // This helper class can be used to mock out Google Test failure reporting
43 | // so that we can test Google Test or code that builds on Google Test.
44 | //
45 | // An object of this class appends a TestPartResult object to the
46 | // TestPartResultArray object given in the constructor whenever a Google Test
47 | // failure is reported. It can either intercept only failures that are
48 | // generated in the same thread that created this object or it can intercept
49 | // all generated failures. The scope of this mock object can be controlled with
50 | // the second argument to the two arguments constructor.
51 | class GTEST_API_ ScopedFakeTestPartResultReporter
52 | : public TestPartResultReporterInterface {
53 | public:
54 | // The two possible mocking modes of this object.
55 | enum InterceptMode {
56 | INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
57 | INTERCEPT_ALL_THREADS // Intercepts all failures.
58 | };
59 |
60 | // The c'tor sets this object as the test part result reporter used
61 | // by Google Test. The 'result' parameter specifies where to report the
62 | // results. This reporter will only catch failures generated in the current
63 | // thread. DEPRECATED
64 | explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
65 |
66 | // Same as above, but you can choose the interception scope of this object.
67 | ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
68 | TestPartResultArray* result);
69 |
70 | // The d'tor restores the previous test part result reporter.
71 | virtual ~ScopedFakeTestPartResultReporter();
72 |
73 | // Appends the TestPartResult object to the TestPartResultArray
74 | // received in the constructor.
75 | //
76 | // This method is from the TestPartResultReporterInterface
77 | // interface.
78 | virtual void ReportTestPartResult(const TestPartResult& result);
79 | private:
80 | void Init();
81 |
82 | const InterceptMode intercept_mode_;
83 | TestPartResultReporterInterface* old_reporter_;
84 | TestPartResultArray* const result_;
85 |
86 | GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
87 | };
88 |
89 | namespace internal {
90 |
91 | // A helper class for implementing EXPECT_FATAL_FAILURE() and
92 | // EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
93 | // TestPartResultArray contains exactly one failure that has the given
94 | // type and contains the given substring. If that's not the case, a
95 | // non-fatal failure will be generated.
96 | class GTEST_API_ SingleFailureChecker {
97 | public:
98 | // The constructor remembers the arguments.
99 | SingleFailureChecker(const TestPartResultArray* results,
100 | TestPartResult::Type type,
101 | const string& substr);
102 | ~SingleFailureChecker();
103 | private:
104 | const TestPartResultArray* const results_;
105 | const TestPartResult::Type type_;
106 | const string substr_;
107 |
108 | GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
109 | };
110 |
111 | } // namespace internal
112 |
113 | } // namespace testing
114 |
115 | // A set of macros for testing Google Test assertions or code that's expected
116 | // to generate Google Test fatal failures. It verifies that the given
117 | // statement will cause exactly one fatal Google Test failure with 'substr'
118 | // being part of the failure message.
119 | //
120 | // There are two different versions of this macro. EXPECT_FATAL_FAILURE only
121 | // affects and considers failures generated in the current thread and
122 | // EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
123 | //
124 | // The verification of the assertion is done correctly even when the statement
125 | // throws an exception or aborts the current function.
126 | //
127 | // Known restrictions:
128 | // - 'statement' cannot reference local non-static variables or
129 | // non-static members of the current object.
130 | // - 'statement' cannot return a value.
131 | // - You cannot stream a failure message to this macro.
132 | //
133 | // Note that even though the implementations of the following two
134 | // macros are much alike, we cannot refactor them to use a common
135 | // helper macro, due to some peculiarity in how the preprocessor
136 | // works. The AcceptsMacroThatExpandsToUnprotectedComma test in
137 | // gtest_unittest.cc will fail to compile if we do that.
138 | #define EXPECT_FATAL_FAILURE(statement, substr) \
139 | do { \
140 | class GTestExpectFatalFailureHelper {\
141 | public:\
142 | static void Execute() { statement; }\
143 | };\
144 | ::testing::TestPartResultArray gtest_failures;\
145 | ::testing::internal::SingleFailureChecker gtest_checker(\
146 | >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
147 | {\
148 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
149 | ::testing::ScopedFakeTestPartResultReporter:: \
150 | INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
151 | GTestExpectFatalFailureHelper::Execute();\
152 | }\
153 | } while (::testing::internal::AlwaysFalse())
154 |
155 | #define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
156 | do { \
157 | class GTestExpectFatalFailureHelper {\
158 | public:\
159 | static void Execute() { statement; }\
160 | };\
161 | ::testing::TestPartResultArray gtest_failures;\
162 | ::testing::internal::SingleFailureChecker gtest_checker(\
163 | >est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
164 | {\
165 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
166 | ::testing::ScopedFakeTestPartResultReporter:: \
167 | INTERCEPT_ALL_THREADS, >est_failures);\
168 | GTestExpectFatalFailureHelper::Execute();\
169 | }\
170 | } while (::testing::internal::AlwaysFalse())
171 |
172 | // A macro for testing Google Test assertions or code that's expected to
173 | // generate Google Test non-fatal failures. It asserts that the given
174 | // statement will cause exactly one non-fatal Google Test failure with 'substr'
175 | // being part of the failure message.
176 | //
177 | // There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
178 | // affects and considers failures generated in the current thread and
179 | // EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
180 | //
181 | // 'statement' is allowed to reference local variables and members of
182 | // the current object.
183 | //
184 | // The verification of the assertion is done correctly even when the statement
185 | // throws an exception or aborts the current function.
186 | //
187 | // Known restrictions:
188 | // - You cannot stream a failure message to this macro.
189 | //
190 | // Note that even though the implementations of the following two
191 | // macros are much alike, we cannot refactor them to use a common
192 | // helper macro, due to some peculiarity in how the preprocessor
193 | // works. If we do that, the code won't compile when the user gives
194 | // EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
195 | // expands to code containing an unprotected comma. The
196 | // AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
197 | // catches that.
198 | //
199 | // For the same reason, we have to write
200 | // if (::testing::internal::AlwaysTrue()) { statement; }
201 | // instead of
202 | // GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
203 | // to avoid an MSVC warning on unreachable code.
204 | #define EXPECT_NONFATAL_FAILURE(statement, substr) \
205 | do {\
206 | ::testing::TestPartResultArray gtest_failures;\
207 | ::testing::internal::SingleFailureChecker gtest_checker(\
208 | >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
209 | (substr));\
210 | {\
211 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
212 | ::testing::ScopedFakeTestPartResultReporter:: \
213 | INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
214 | if (::testing::internal::AlwaysTrue()) { statement; }\
215 | }\
216 | } while (::testing::internal::AlwaysFalse())
217 |
218 | #define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
219 | do {\
220 | ::testing::TestPartResultArray gtest_failures;\
221 | ::testing::internal::SingleFailureChecker gtest_checker(\
222 | >est_failures, ::testing::TestPartResult::kNonFatalFailure, \
223 | (substr));\
224 | {\
225 | ::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
226 | ::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
227 | >est_failures);\
228 | if (::testing::internal::AlwaysTrue()) { statement; }\
229 | }\
230 | } while (::testing::internal::AlwaysFalse())
231 |
232 | #endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
233 |
--------------------------------------------------------------------------------
/Libraries/build/include/gtest/internal/gtest-tuple.h.pump:
--------------------------------------------------------------------------------
1 | $$ -*- mode: c++; -*-
2 | $var n = 10 $$ Maximum number of tuple fields we want to support.
3 | $$ This meta comment fixes auto-indentation in Emacs. }}
4 | // Copyright 2009 Google Inc.
5 | // All Rights Reserved.
6 | //
7 | // Redistribution and use in source and binary forms, with or without
8 | // modification, are permitted provided that the following conditions are
9 | // met:
10 | //
11 | // * Redistributions of source code must retain the above copyright
12 | // notice, this list of conditions and the following disclaimer.
13 | // * Redistributions in binary form must reproduce the above
14 | // copyright notice, this list of conditions and the following disclaimer
15 | // in the documentation and/or other materials provided with the
16 | // distribution.
17 | // * Neither the name of Google Inc. nor the names of its
18 | // contributors may be used to endorse or promote products derived from
19 | // this software without specific prior written permission.
20 | //
21 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | //
33 | // Author: wan@google.com (Zhanyong Wan)
34 |
35 | // Implements a subset of TR1 tuple needed by Google Test and Google Mock.
36 |
37 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
38 | #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
39 |
40 | #include // For ::std::pair.
41 |
42 | // The compiler used in Symbian has a bug that prevents us from declaring the
43 | // tuple template as a friend (it complains that tuple is redefined). This
44 | // hack bypasses the bug by declaring the members that should otherwise be
45 | // private as public.
46 | // Sun Studio versions < 12 also have the above bug.
47 | #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
48 | # define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
49 | #else
50 | # define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
51 | template friend class tuple; \
52 | private:
53 | #endif
54 |
55 | // Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that conflict
56 | // with our own definitions. Therefore using our own tuple does not work on
57 | // those compilers.
58 | #if defined(_MSC_VER) && _MSC_VER >= 1600 /* 1600 is Visual Studio 2010 */
59 | # error "gtest's tuple doesn't compile on Visual Studio 2010 or later. \
60 | GTEST_USE_OWN_TR1_TUPLE must be set to 0 on those compilers."
61 | #endif
62 |
63 |
64 | $range i 0..n-1
65 | $range j 0..n
66 | $range k 1..n
67 | // GTEST_n_TUPLE_(T) is the type of an n-tuple.
68 | #define GTEST_0_TUPLE_(T) tuple<>
69 |
70 | $for k [[
71 | $range m 0..k-1
72 | $range m2 k..n-1
73 | #define GTEST_$(k)_TUPLE_(T) tuple<$for m, [[T##$m]]$for m2 [[, void]]>
74 |
75 | ]]
76 |
77 | // GTEST_n_TYPENAMES_(T) declares a list of n typenames.
78 |
79 | $for j [[
80 | $range m 0..j-1
81 | #define GTEST_$(j)_TYPENAMES_(T) $for m, [[typename T##$m]]
82 |
83 |
84 | ]]
85 |
86 | // In theory, defining stuff in the ::std namespace is undefined
87 | // behavior. We can do this as we are playing the role of a standard
88 | // library vendor.
89 | namespace std {
90 | namespace tr1 {
91 |
92 | template <$for i, [[typename T$i = void]]>
93 | class tuple;
94 |
95 | // Anything in namespace gtest_internal is Google Test's INTERNAL
96 | // IMPLEMENTATION DETAIL and MUST NOT BE USED DIRECTLY in user code.
97 | namespace gtest_internal {
98 |
99 | // ByRef::type is T if T is a reference; otherwise it's const T&.
100 | template
101 | struct ByRef { typedef const T& type; }; // NOLINT
102 | template
103 | struct ByRef { typedef T& type; }; // NOLINT
104 |
105 | // A handy wrapper for ByRef.
106 | #define GTEST_BY_REF_(T) typename ::std::tr1::gtest_internal::ByRef::type
107 |
108 | // AddRef::type is T if T is a reference; otherwise it's T&. This
109 | // is the same as tr1::add_reference::type.
110 | template
111 | struct AddRef { typedef T& type; }; // NOLINT
112 | template
113 | struct AddRef { typedef T& type; }; // NOLINT
114 |
115 | // A handy wrapper for AddRef.
116 | #define GTEST_ADD_REF_(T) typename ::std::tr1::gtest_internal::AddRef::type
117 |
118 | // A helper for implementing get().
119 | template class Get;
120 |
121 | // A helper for implementing tuple_element. kIndexValid is true
122 | // iff k < the number of fields in tuple type T.
123 | template
124 | struct TupleElement;
125 |
126 |
127 | $for i [[
128 | template
129 | struct TupleElement