55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/thirdparty/googletest/docs/assets/css/style.scss:
--------------------------------------------------------------------------------
1 | ---
2 | ---
3 |
4 | @import "jekyll-theme-primer";
5 | @import "main";
6 |
--------------------------------------------------------------------------------
/thirdparty/googletest/docs/community_created_documentation.md:
--------------------------------------------------------------------------------
1 | # Community-Created Documentation
2 |
3 | The following is a list, in no particular order, of links to documentation
4 | created by the Googletest community.
5 |
6 | * [Googlemock Insights](https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/master/googletest/insights.md),
7 | by [ElectricRCAircraftGuy](https://github.com/ElectricRCAircraftGuy)
8 |
--------------------------------------------------------------------------------
/thirdparty/googletest/docs/index.md:
--------------------------------------------------------------------------------
1 | # GoogleTest User's Guide
2 |
3 | ## Welcome to GoogleTest!
4 |
5 | GoogleTest is Google's C++ testing and mocking framework. This user's guide has
6 | the following contents:
7 |
8 | * [GoogleTest Primer](primer.md) - Teaches you how to write simple tests using
9 | GoogleTest. Read this first if you are new to GoogleTest.
10 | * [GoogleTest Advanced](advanced.md) - Read this when you've finished the
11 | Primer and want to utilize GoogleTest to its full potential.
12 | * [GoogleTest Samples](samples.md) - Describes some GoogleTest samples.
13 | * [GoogleTest FAQ](faq.md) - Have a question? Want some tips? Check here
14 | first.
15 | * [Mocking for Dummies](gmock_for_dummies.md) - Teaches you how to create mock
16 | objects and use them in tests.
17 | * [Mocking Cookbook](gmock_cook_book.md) - Includes tips and approaches to
18 | common mocking use cases.
19 | * [Mocking Cheat Sheet](gmock_cheat_sheet.md) - A handy reference for
20 | matchers, actions, invariants, and more.
21 | * [Mocking FAQ](gmock_faq.md) - Contains answers to some mocking-specific
22 | questions.
23 |
--------------------------------------------------------------------------------
/thirdparty/googletest/docs/platforms.md:
--------------------------------------------------------------------------------
1 | # Supported Platforms
2 |
3 | GoogleTest requires a codebase and compiler compliant with the C++11 standard or
4 | newer.
5 |
6 | The GoogleTest code is officially supported on the following platforms.
7 | Operating systems or tools not listed below are community-supported. For
8 | community-supported platforms, patches that do not complicate the code may be
9 | considered.
10 |
11 | If you notice any problems on your platform, please file an issue on the
12 | [GoogleTest GitHub Issue Tracker](https://github.com/google/googletest/issues).
13 | Pull requests containing fixes are welcome!
14 |
15 | ### Operating systems
16 |
17 | * Linux
18 | * macOS
19 | * Windows
20 |
21 | ### Compilers
22 |
23 | * gcc 5.0+
24 | * clang 5.0+
25 | * MSVC 2015+
26 |
27 | **macOS users:** Xcode 9.3+ provides clang 5.0+.
28 |
29 | ### Build systems
30 |
31 | * [Bazel](https://bazel.build/)
32 | * [CMake](https://cmake.org/)
33 |
34 | Bazel is the build system used by the team internally and in tests. CMake is
35 | supported on a best-effort basis and by the community.
36 |
--------------------------------------------------------------------------------
/thirdparty/googletest/docs/samples.md:
--------------------------------------------------------------------------------
1 | # Googletest Samples
2 |
3 | If you're like us, you'd like to look at
4 | [googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples)
5 | The sample directory has a number of well-commented samples showing how to use a
6 | variety of googletest features.
7 |
8 | * Sample #1 shows the basic steps of using googletest to test C++ functions.
9 | * Sample #2 shows a more complex unit test for a class with multiple member
10 | functions.
11 | * Sample #3 uses a test fixture.
12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to
13 | get the best of both libraries.
14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in
15 | derived fixtures.
16 | * Sample #6 demonstrates type-parameterized tests.
17 | * Sample #7 teaches the basics of value-parameterized tests.
18 | * Sample #8 shows using `Combine()` in value-parameterized tests.
19 | * Sample #9 shows use of the listener API to modify Google Test's console
20 | output and the use of its reflection API to inspect test results.
21 | * Sample #10 shows use of the listener API to implement a primitive memory
22 | leak checker.
23 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/README.md:
--------------------------------------------------------------------------------
1 | # Googletest Mocking (gMock) Framework
2 |
3 | ### Overview
4 |
5 | Google's framework for writing and using C++ mock classes. It can help you
6 | derive better designs of your system and write better tests.
7 |
8 | It is inspired by:
9 |
10 | * [jMock](http://www.jmock.org/)
11 | * [EasyMock](http://www.easymock.org/)
12 | * [Hamcrest](http://code.google.com/p/hamcrest/)
13 |
14 | It is designed with C++'s specifics in mind.
15 |
16 | gMock:
17 |
18 | - Provides a declarative syntax for defining mocks.
19 | - Can define partial (hybrid) mocks, which are a cross of real and mock
20 | objects.
21 | - Handles functions of arbitrary types and overloaded functions.
22 | - Comes with a rich set of matchers for validating function arguments.
23 | - Uses an intuitive syntax for controlling the behavior of a mock.
24 | - Does automatic verification of expectations (no record-and-replay needed).
25 | - Allows arbitrary (partial) ordering constraints on function calls to be
26 | expressed.
27 | - Lets a user extend it by defining new matchers and actions.
28 | - Does not use exceptions.
29 | - Is easy to learn and use.
30 |
31 | Details and examples can be found here:
32 |
33 | * [gMock for Dummies](https://google.github.io/googletest/gmock_for_dummies.html)
34 | * [Legacy gMock FAQ](https://google.github.io/googletest/gmock_faq.html)
35 | * [gMock Cookbook](https://google.github.io/googletest/gmock_cook_book.html)
36 | * [gMock Cheat Sheet](https://google.github.io/googletest/gmock_cheat_sheet.html)
37 |
38 | GoogleMock is a part of
39 | [GoogleTest C++ testing framework](http://github.com/google/googletest/) and a
40 | subject to the same requirements.
41 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/cmake/gmock.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gmock
5 | Description: GoogleMock (without main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Requires: gtest = @PROJECT_VERSION@
9 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@
10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
11 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/cmake/gmock_main.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gmock_main
5 | Description: GoogleMock (with main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Requires: gmock = @PROJECT_VERSION@
9 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@
10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
11 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/docs/README.md:
--------------------------------------------------------------------------------
1 | # Content Moved
2 |
3 | We are working on updates to the GoogleTest documentation, which has moved to
4 | the top-level [docs](../../docs) directory.
5 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/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 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file implements some matchers that depend on gmock-matchers.h.
34 | //
35 | // Note that tests are implemented in gmock-matchers_test.cc rather than
36 | // gmock-more-matchers-test.cc.
37 |
38 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
39 | #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
40 |
41 | #include "gmock/gmock-matchers.h"
42 |
43 | namespace testing {
44 |
45 | // Silence C4100 (unreferenced formal
46 | // parameter) for MSVC
47 | #ifdef _MSC_VER
48 | # pragma warning(push)
49 | # pragma warning(disable:4100)
50 | #if (_MSC_VER == 1900)
51 | // and silence C4800 (C4800: 'int *const ': forcing value
52 | // to bool 'true' or 'false') for MSVC 14
53 | # pragma warning(disable:4800)
54 | #endif
55 | #endif
56 |
57 | // Defines a matcher that matches an empty container. The container must
58 | // support both size() and empty(), which all STL-like containers provide.
59 | MATCHER(IsEmpty, negation ? "isn't empty" : "is empty") {
60 | if (arg.empty()) {
61 | return true;
62 | }
63 | *result_listener << "whose size is " << arg.size();
64 | return false;
65 | }
66 |
67 | // Define a matcher that matches a value that evaluates in boolean
68 | // context to true. Useful for types that define "explicit operator
69 | // bool" operators and so can't be compared for equality with true
70 | // and false.
71 | MATCHER(IsTrue, negation ? "is false" : "is true") {
72 | return static_cast(arg);
73 | }
74 |
75 | // Define a matcher that matches a value that evaluates in boolean
76 | // context to false. Useful for types that define "explicit operator
77 | // bool" operators and so can't be compared for equality with true
78 | // and false.
79 | MATCHER(IsFalse, negation ? "is true" : "is false") {
80 | return !static_cast(arg);
81 | }
82 |
83 | #ifdef _MSC_VER
84 | # pragma warning(pop)
85 | #endif
86 |
87 |
88 | } // namespace testing
89 |
90 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_MORE_MATCHERS_H_
91 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/include/gmock/internal/custom/README.md:
--------------------------------------------------------------------------------
1 | # Customization Points
2 |
3 | The custom directory is an injection point for custom user configurations.
4 |
5 | ## Header `gmock-port.h`
6 |
7 | The following macros can be defined:
8 |
9 | ### Flag related macros:
10 |
11 | * `GMOCK_DECLARE_bool_(name)`
12 | * `GMOCK_DECLARE_int32_(name)`
13 | * `GMOCK_DECLARE_string_(name)`
14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)`
15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)`
16 | * `GMOCK_DEFINE_string_(name, default_val, doc)`
17 | * `GMOCK_FLAG_GET(flag_name)`
18 | * `GMOCK_FLAG_SET(flag_name, value)`
19 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h:
--------------------------------------------------------------------------------
1 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
2 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
3 |
4 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_
5 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/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 | // Injection point for custom user configurations. See README for details
31 |
32 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
33 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
34 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_
35 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/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. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | #ifndef GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
35 | #define GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
36 |
37 | #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_
38 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/src/gmock-all.cc:
--------------------------------------------------------------------------------
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 | //
31 | // Google C++ Mocking Framework (Google Mock)
32 | //
33 | // This file #includes all Google Mock implementation .cc files. The
34 | // purpose is to allow a user to build Google Mock by compiling this
35 | // file alone.
36 |
37 | // This line ensures that gmock.h can be compiled on its own, even
38 | // when it's fused.
39 | #include "gmock/gmock.h"
40 |
41 | // The following lines pull in the real gmock *.cc files.
42 | #include "src/gmock-cardinalities.cc"
43 | #include "src/gmock-internal-utils.cc"
44 | #include "src/gmock-matchers.cc"
45 | #include "src/gmock-spec-builders.cc"
46 | #include "src/gmock.cc"
47 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/src/gmock_main.cc:
--------------------------------------------------------------------------------
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 |
31 | #include
32 | #include "gmock/gmock.h"
33 | #include "gtest/gtest.h"
34 |
35 | #if GTEST_OS_ESP8266 || GTEST_OS_ESP32
36 | #if GTEST_OS_ESP8266
37 | extern "C" {
38 | #endif
39 | void setup() {
40 | // Since Google Mock depends on Google Test, InitGoogleMock() is
41 | // also responsible for initializing Google Test. Therefore there's
42 | // no need for calling testing::InitGoogleTest() separately.
43 | testing::InitGoogleMock();
44 | }
45 | void loop() { RUN_ALL_TESTS(); }
46 | #if GTEST_OS_ESP8266
47 | }
48 | #endif
49 |
50 | #else
51 |
52 | // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
53 | // causes a link error when _tmain is defined in a static library and UNICODE
54 | // is enabled. For this reason instead of _tmain, main function is used on
55 | // Windows. See the following link to track the current status of this bug:
56 | // https://web.archive.org/web/20170912203238/connect.microsoft.com/VisualStudio/feedback/details/394464/wmain-link-error-in-the-static-library
57 | // // NOLINT
58 | #if GTEST_OS_WINDOWS_MOBILE
59 | # include // NOLINT
60 |
61 | GTEST_API_ int _tmain(int argc, TCHAR** argv) {
62 | #else
63 | GTEST_API_ int main(int argc, char** argv) {
64 | #endif // GTEST_OS_WINDOWS_MOBILE
65 | std::cout << "Running main() from gmock_main.cc\n";
66 | // Since Google Mock depends on Google Test, InitGoogleMock() is
67 | // also responsible for initializing Google Test. Therefore there's
68 | // no need for calling testing::InitGoogleTest() separately.
69 | testing::InitGoogleMock(&argc, argv);
70 | return RUN_ALL_TESTS();
71 | }
72 | #endif
73 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock-port_test.cc:
--------------------------------------------------------------------------------
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 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file tests the internal cross-platform support utilities.
34 |
35 | #include "gmock/internal/gmock-port.h"
36 | #include "gtest/gtest.h"
37 |
38 | // NOTE: if this file is left without tests for some reason, put a dummy
39 | // test here to make references to symbols in the gtest library and avoid
40 | // 'undefined symbol' linker errors in gmock_main:
41 |
42 | TEST(DummyTest, Dummy) {}
43 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock_all_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Tests for Google C++ Mocking Framework (Google Mock)
32 | //
33 | // Some users use a build system that Google Mock doesn't support directly,
34 | // yet they still want to build and run Google Mock's own tests. This file
35 | // includes most such tests, making it easier for these users to maintain
36 | // their build scripts (they just need to build this file, even though the
37 | // below list of actual *_test.cc files might change).
38 | #include "test/gmock-actions_test.cc"
39 | #include "test/gmock-cardinalities_test.cc"
40 | #include "test/gmock-internal-utils_test.cc"
41 | #include "test/gmock-matchers_test.cc"
42 | #include "test/gmock-more-actions_test.cc"
43 | #include "test/gmock-nice-strict_test.cc"
44 | #include "test/gmock-port_test.cc"
45 | #include "test/gmock-spec-builders_test.cc"
46 | #include "test/gmock_test.cc"
47 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock_ex_test.cc:
--------------------------------------------------------------------------------
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 |
31 | // Tests Google Mock's functionality that depends on exceptions.
32 |
33 | #include "gmock/gmock.h"
34 | #include "gtest/gtest.h"
35 |
36 | #if GTEST_HAS_EXCEPTIONS
37 | namespace {
38 |
39 | using testing::HasSubstr;
40 |
41 | using testing::internal::GoogleTestFailureException;
42 |
43 | // A type that cannot be default constructed.
44 | class NonDefaultConstructible {
45 | public:
46 | explicit NonDefaultConstructible(int /* dummy */) {}
47 | };
48 |
49 | class MockFoo {
50 | public:
51 | // A mock method that returns a user-defined type. Google Mock
52 | // doesn't know what the default value for this type is.
53 | MOCK_METHOD0(GetNonDefaultConstructible, NonDefaultConstructible());
54 | };
55 |
56 | TEST(DefaultValueTest, ThrowsRuntimeErrorWhenNoDefaultValue) {
57 | MockFoo mock;
58 | try {
59 | // No expectation is set on this method, so Google Mock must
60 | // return the default value. However, since Google Mock knows
61 | // nothing about the return type, it doesn't know what to return,
62 | // and has to throw (when exceptions are enabled) or abort
63 | // (otherwise).
64 | mock.GetNonDefaultConstructible();
65 | FAIL() << "GetNonDefaultConstructible()'s return type has no default "
66 | << "value, so Google Mock should have thrown.";
67 | } catch (const GoogleTestFailureException& /* unused */) {
68 | FAIL() << "Google Test does not try to catch an exception of type "
69 | << "GoogleTestFailureException, which is used for reporting "
70 | << "a failure to other testing frameworks. Google Mock should "
71 | << "not throw a GoogleTestFailureException as it will kill the "
72 | << "entire test program instead of just the current TEST.";
73 | } catch (const std::exception& ex) {
74 | EXPECT_THAT(ex.what(), HasSubstr("has no default value"));
75 | }
76 | }
77 |
78 |
79 | } // unnamed namespace
80 | #endif
81 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock_leak_test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This program is for verifying that a leaked mock object can be
34 | // caught by Google Mock's leak detector.
35 |
36 | #include "gmock/gmock.h"
37 |
38 | namespace {
39 |
40 | using ::testing::Return;
41 |
42 | class FooInterface {
43 | public:
44 | virtual ~FooInterface() {}
45 | virtual void DoThis() = 0;
46 | };
47 |
48 | class MockFoo : public FooInterface {
49 | public:
50 | MockFoo() {}
51 |
52 | MOCK_METHOD0(DoThis, void());
53 |
54 | private:
55 | GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
56 | };
57 |
58 | TEST(LeakTest, LeakedMockWithExpectCallCausesFailureWhenLeakCheckingIsEnabled) {
59 | MockFoo* foo = new MockFoo;
60 |
61 | EXPECT_CALL(*foo, DoThis());
62 | foo->DoThis();
63 |
64 | // In order to test the leak detector, we deliberately leak foo.
65 |
66 | // Makes sure Google Mock's leak detector can change the exit code
67 | // to 1 even when the code is already exiting with 0.
68 | exit(0);
69 | }
70 |
71 | TEST(LeakTest, LeakedMockWithOnCallCausesFailureWhenLeakCheckingIsEnabled) {
72 | MockFoo* foo = new MockFoo;
73 |
74 | ON_CALL(*foo, DoThis()).WillByDefault(Return());
75 |
76 | // In order to test the leak detector, we deliberately leak foo.
77 |
78 | // Makes sure Google Mock's leak detector can change the exit code
79 | // to 1 even when the code is already exiting with 0.
80 | exit(0);
81 | }
82 |
83 | TEST(LeakTest, CatchesMultipleLeakedMockObjects) {
84 | MockFoo* foo1 = new MockFoo;
85 | MockFoo* foo2 = new MockFoo;
86 |
87 | ON_CALL(*foo1, DoThis()).WillByDefault(Return());
88 | EXPECT_CALL(*foo2, DoThis());
89 | foo2->DoThis();
90 |
91 | // In order to test the leak detector, we deliberately leak foo1 and
92 | // foo2.
93 |
94 | // Makes sure Google Mock's leak detector can change the exit code
95 | // to 1 even when the code is already exiting with 0.
96 | exit(0);
97 | }
98 |
99 | } // namespace
100 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock_link2_test.cc:
--------------------------------------------------------------------------------
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 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file is for verifying that various Google Mock constructs do not
34 | // produce linker errors when instantiated in different translation units.
35 | // Please see gmock_link_test.h for details.
36 |
37 | #define LinkTest LinkTest2
38 |
39 | #include "test/gmock_link_test.h"
40 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googlemock/test/gmock_link_test.cc:
--------------------------------------------------------------------------------
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 |
31 | // Google Mock - a framework for writing C++ mock classes.
32 | //
33 | // This file is for verifying that various Google Mock constructs do not
34 | // produce linker errors when instantiated in different translation units.
35 | // Please see gmock_link_test.h for details.
36 |
37 | #define LinkTest LinkTest1
38 |
39 | #include "test/gmock_link_test.h"
40 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/cmake/Config.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 | include(CMakeFindDependencyMacro)
3 | if (@GTEST_HAS_PTHREAD@)
4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@)
5 | find_dependency(Threads)
6 | endif()
7 |
8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
9 | check_required_components("@project_name@")
10 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/cmake/gtest.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gtest
5 | Description: GoogleTest (without main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@
9 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
10 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/cmake/gtest_main.pc.in:
--------------------------------------------------------------------------------
1 | libdir=@CMAKE_INSTALL_FULL_LIBDIR@
2 | includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
3 |
4 | Name: gtest_main
5 | Description: GoogleTest (with main() function)
6 | Version: @PROJECT_VERSION@
7 | URL: https://github.com/google/googletest
8 | Requires: gtest = @PROJECT_VERSION@
9 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@
10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@
11 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/cmake/libgtest.la.in:
--------------------------------------------------------------------------------
1 | # libgtest.la - a libtool library file
2 | # Generated by libtool (GNU libtool) 2.4.6
3 |
4 | # Please DO NOT delete this file!
5 | # It is necessary for linking the library.
6 |
7 | # Names of this library.
8 | library_names='libgtest.so'
9 |
10 | # Is this an already installed library?
11 | installed=yes
12 |
13 | # Should we warn about portability when linking against -modules?
14 | shouldnotlink=no
15 |
16 | # Files to dlopen/dlpreopen
17 | dlopen=''
18 | dlpreopen=''
19 |
20 | # Directory that this library needs to be installed in:
21 | libdir='@CMAKE_INSTALL_FULL_LIBDIR@'
22 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/docs/README.md:
--------------------------------------------------------------------------------
1 | # Content Moved
2 |
3 | We are working on updates to the GoogleTest documentation, which has moved to
4 | the top-level [docs](../../docs) directory.
5 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/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 | //
31 | // Google C++ Testing and Mocking Framework definitions useful in production code.
32 |
33 | #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
34 | #define GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
35 |
36 | // When you need to test the private or protected members of a class,
37 | // use the FRIEND_TEST macro to declare your tests as friends of the
38 | // class. For example:
39 | //
40 | // class MyClass {
41 | // private:
42 | // void PrivateMethod();
43 | // FRIEND_TEST(MyClassTest, PrivateMethodWorks);
44 | // };
45 | //
46 | // class MyClassTest : public testing::Test {
47 | // // ...
48 | // };
49 | //
50 | // TEST_F(MyClassTest, PrivateMethodWorks) {
51 | // // Can call MyClass::PrivateMethod() here.
52 | // }
53 | //
54 | // Note: The test class must be in the same namespace as the class being tested.
55 | // For example, putting MyClassTest in an anonymous namespace will not work.
56 |
57 | #define FRIEND_TEST(test_case_name, test_name)\
58 | friend class test_case_name##_##test_name##_Test
59 |
60 | #endif // GOOGLETEST_INCLUDE_GTEST_GTEST_PROD_H_
61 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/include/gtest/internal/custom/README.md:
--------------------------------------------------------------------------------
1 | # Customization Points
2 |
3 | The custom directory is an injection point for custom user configurations.
4 |
5 | ## Header `gtest.h`
6 |
7 | ### The following macros can be defined:
8 |
9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of
10 | `OsStackTraceGetterInterface`.
11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See
12 | `testing::TempDir` for semantics and signature.
13 |
14 | ## Header `gtest-port.h`
15 |
16 | The following macros can be defined:
17 |
18 | ### Flag related macros:
19 |
20 | * `GTEST_FLAG(flag_name)`
21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its
22 | own flagfile flag parsing.
23 | * `GTEST_DECLARE_bool_(name)`
24 | * `GTEST_DECLARE_int32_(name)`
25 | * `GTEST_DECLARE_string_(name)`
26 | * `GTEST_DEFINE_bool_(name, default_val, doc)`
27 | * `GTEST_DEFINE_int32_(name, default_val, doc)`
28 | * `GTEST_DEFINE_string_(name, default_val, doc)`
29 | * `GTEST_FLAG_GET(flag_name)`
30 | * `GTEST_FLAG_SET(flag_name, value)`
31 |
32 | ### Logging:
33 |
34 | * `GTEST_LOG_(severity)`
35 | * `GTEST_CHECK_(condition)`
36 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too.
37 |
38 | ### Threading:
39 |
40 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided.
41 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal`
42 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)`
43 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)`
44 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)`
45 | * `GTEST_LOCK_EXCLUDED_(locks)`
46 |
47 | ### Underlying library support features
48 |
49 | * `GTEST_HAS_CXXABI_H_`
50 |
51 | ### Exporting API symbols:
52 |
53 | * `GTEST_API_` - Specifier for exported symbols.
54 |
55 | ## Header `gtest-printers.h`
56 |
57 | * See documentation at `gtest/gtest-printers.h` for details on how to define a
58 | custom printer.
59 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/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. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
36 |
37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_
38 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/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 | //
35 | // Injection point for custom user configurations. See README for details
36 | //
37 | // ** Custom implementation starts here **
38 |
39 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
40 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
41 |
42 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_
43 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/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. See README for details
31 | //
32 | // ** Custom implementation starts here **
33 |
34 | #ifndef GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
35 | #define GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
36 |
37 | #endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_
38 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample1.cc:
--------------------------------------------------------------------------------
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 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #include "sample1.h"
33 |
34 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1.
35 | int Factorial(int n) {
36 | int result = 1;
37 | for (int i = 1; i <= n; i++) {
38 | result *= i;
39 | }
40 |
41 | return result;
42 | }
43 |
44 | // Returns true if and only if n is a prime number.
45 | bool IsPrime(int n) {
46 | // Trivial case 1: small numbers
47 | if (n <= 1) return false;
48 |
49 | // Trivial case 2: even numbers
50 | if (n % 2 == 0) return n == 2;
51 |
52 | // Now, we have that n is odd and n >= 3.
53 |
54 | // Try to divide n by every odd number i, starting from 3
55 | for (int i = 3; ; i += 2) {
56 | // We only have to try i up to the square root of n
57 | if (i > n/i) break;
58 |
59 | // Now, we have i <= n/i < n.
60 | // If n is divisible by i, n is not prime.
61 | if (n % i == 0) return false;
62 | }
63 |
64 | // n has no integer factor in the range (1, n), and thus is prime.
65 | return true;
66 | }
67 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample1.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 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #ifndef GOOGLETEST_SAMPLES_SAMPLE1_H_
33 | #define GOOGLETEST_SAMPLES_SAMPLE1_H_
34 |
35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1.
36 | int Factorial(int n);
37 |
38 | // Returns true if and only if n is a prime number.
39 | bool IsPrime(int n);
40 |
41 | #endif // GOOGLETEST_SAMPLES_SAMPLE1_H_
42 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample2.cc:
--------------------------------------------------------------------------------
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 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #include "sample2.h"
33 |
34 | #include
35 |
36 | // Clones a 0-terminated C string, allocating memory using new.
37 | const char* MyString::CloneCString(const char* a_c_string) {
38 | if (a_c_string == nullptr) return nullptr;
39 |
40 | const size_t len = strlen(a_c_string);
41 | char* const clone = new char[ len + 1 ];
42 | memcpy(clone, a_c_string, len + 1);
43 |
44 | return clone;
45 | }
46 |
47 | // Sets the 0-terminated C string this MyString object
48 | // represents.
49 | void MyString::Set(const char* a_c_string) {
50 | // Makes sure this works when c_string == c_string_
51 | const char* const temp = MyString::CloneCString(a_c_string);
52 | delete[] c_string_;
53 | c_string_ = temp;
54 | }
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample2.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 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #ifndef GOOGLETEST_SAMPLES_SAMPLE2_H_
33 | #define GOOGLETEST_SAMPLES_SAMPLE2_H_
34 |
35 | #include
36 |
37 |
38 | // A simple string class.
39 | class MyString {
40 | private:
41 | const char* c_string_;
42 | const MyString& operator=(const MyString& rhs);
43 |
44 | public:
45 | // Clones a 0-terminated C string, allocating memory using new.
46 | static const char* CloneCString(const char* a_c_string);
47 |
48 | ////////////////////////////////////////////////////////////
49 | //
50 | // C'tors
51 |
52 | // The default c'tor constructs a NULL string.
53 | MyString() : c_string_(nullptr) {}
54 |
55 | // Constructs a MyString by cloning a 0-terminated C string.
56 | explicit MyString(const char* a_c_string) : c_string_(nullptr) {
57 | Set(a_c_string);
58 | }
59 |
60 | // Copy c'tor
61 | MyString(const MyString& string) : c_string_(nullptr) {
62 | Set(string.c_string_);
63 | }
64 |
65 | ////////////////////////////////////////////////////////////
66 | //
67 | // D'tor. MyString is intended to be a final class, so the d'tor
68 | // doesn't need to be virtual.
69 | ~MyString() { delete[] c_string_; }
70 |
71 | // Gets the 0-terminated C string this MyString object represents.
72 | const char* c_string() const { return c_string_; }
73 |
74 | size_t Length() const { return c_string_ == nullptr ? 0 : strlen(c_string_); }
75 |
76 | // Sets the 0-terminated C string this MyString object represents.
77 | void Set(const char* c_string);
78 | };
79 |
80 | #endif // GOOGLETEST_SAMPLES_SAMPLE2_H_
81 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample4.cc:
--------------------------------------------------------------------------------
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 | // A sample program demonstrating using Google C++ testing framework.
31 |
32 | #include
33 |
34 | #include "sample4.h"
35 |
36 | // Returns the current counter value, and increments it.
37 | int Counter::Increment() {
38 | return counter_++;
39 | }
40 |
41 | // Returns the current counter value, and decrements it.
42 | // counter can not be less than 0, return 0 in this case
43 | int Counter::Decrement() {
44 | if (counter_ == 0) {
45 | return counter_;
46 | } else {
47 | return counter_--;
48 | }
49 | }
50 |
51 | // Prints the current counter value to STDOUT.
52 | void Counter::Print() const {
53 | printf("%d", counter_);
54 | }
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample4.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 | // A sample program demonstrating using Google C++ testing framework.
31 | #ifndef GOOGLETEST_SAMPLES_SAMPLE4_H_
32 | #define GOOGLETEST_SAMPLES_SAMPLE4_H_
33 |
34 | // A simple monotonic counter.
35 | class Counter {
36 | private:
37 | int counter_;
38 |
39 | public:
40 | // Creates a counter that starts at 0.
41 | Counter() : counter_(0) {}
42 |
43 | // Returns the current counter value, and increments it.
44 | int Increment();
45 |
46 | // Returns the current counter value, and decrements it.
47 | int Decrement();
48 |
49 | // Prints the current counter value to STDOUT.
50 | void Print() const;
51 | };
52 |
53 | #endif // GOOGLETEST_SAMPLES_SAMPLE4_H_
54 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/samples/sample4_unittest.cc:
--------------------------------------------------------------------------------
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 |
31 | #include "sample4.h"
32 | #include "gtest/gtest.h"
33 |
34 | namespace {
35 | // Tests the Increment() method.
36 |
37 | TEST(Counter, Increment) {
38 | Counter c;
39 |
40 | // Test that counter 0 returns 0
41 | EXPECT_EQ(0, c.Decrement());
42 |
43 | // EXPECT_EQ() evaluates its arguments exactly once, so they
44 | // can have side effects.
45 |
46 | EXPECT_EQ(0, c.Increment());
47 | EXPECT_EQ(1, c.Increment());
48 | EXPECT_EQ(2, c.Increment());
49 |
50 | EXPECT_EQ(3, c.Decrement());
51 | }
52 |
53 | } // namespace
54 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/src/gtest-all.cc:
--------------------------------------------------------------------------------
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 | //
31 | // Google C++ Testing and Mocking Framework (Google Test)
32 | //
33 | // Sometimes it's desirable to build Google Test by compiling a single file.
34 | // This file serves this purpose.
35 |
36 | // This line ensures that gtest.h can be compiled on its own, even
37 | // when it's fused.
38 | #include "gtest/gtest.h"
39 |
40 | // The following lines pull in the real gtest *.cc files.
41 | #include "src/gtest.cc"
42 | #include "src/gtest-death-test.cc"
43 | #include "src/gtest-filepath.cc"
44 | #include "src/gtest-matchers.cc"
45 | #include "src/gtest-port.cc"
46 | #include "src/gtest-printers.cc"
47 | #include "src/gtest-test-part.cc"
48 | #include "src/gtest-typed-test.cc"
49 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/src/gtest_main.cc:
--------------------------------------------------------------------------------
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 | #include
31 | #include "gtest/gtest.h"
32 |
33 | #if GTEST_OS_ESP8266 || GTEST_OS_ESP32
34 | #if GTEST_OS_ESP8266
35 | extern "C" {
36 | #endif
37 | void setup() {
38 | testing::InitGoogleTest();
39 | }
40 |
41 | void loop() { RUN_ALL_TESTS(); }
42 |
43 | #if GTEST_OS_ESP8266
44 | }
45 | #endif
46 |
47 | #else
48 |
49 | GTEST_API_ int main(int argc, char **argv) {
50 | printf("Running main() from %s\n", __FILE__);
51 | testing::InitGoogleTest(&argc, argv);
52 | return RUN_ALL_TESTS();
53 | }
54 | #endif
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-break-on-failure-unittest_.cc:
--------------------------------------------------------------------------------
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 |
31 | // Unit test for Google Test's break-on-failure mode.
32 | //
33 | // A user can ask Google Test to seg-fault when an assertion fails, using
34 | // either the GTEST_BREAK_ON_FAILURE environment variable or the
35 | // --gtest_break_on_failure flag. This file is used for testing such
36 | // functionality.
37 | //
38 | // This program will be invoked from a Python unit test. It is
39 | // expected to fail. Don't run it directly.
40 |
41 | #include "gtest/gtest.h"
42 |
43 | #if GTEST_OS_WINDOWS
44 | # include
45 | # include
46 | #endif
47 |
48 | namespace {
49 |
50 | // A test that's expected to fail.
51 | TEST(Foo, Bar) {
52 | EXPECT_EQ(2, 3);
53 | }
54 |
55 | #if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
56 | // On Windows Mobile global exception handlers are not supported.
57 | LONG WINAPI ExitWithExceptionCode(
58 | struct _EXCEPTION_POINTERS* exception_pointers) {
59 | exit(exception_pointers->ExceptionRecord->ExceptionCode);
60 | }
61 | #endif
62 |
63 | } // namespace
64 |
65 | int main(int argc, char **argv) {
66 | #if GTEST_OS_WINDOWS
67 | // Suppresses display of the Windows error dialog upon encountering
68 | // a general protection fault (segment violation).
69 | SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
70 |
71 | # if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
72 |
73 | // The default unhandled exception filter does not always exit
74 | // with the exception code as exit code - for example it exits with
75 | // 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
76 | // if the application is compiled in debug mode. Thus we use our own
77 | // filter which always exits with the exception code for unhandled
78 | // exceptions.
79 | SetUnhandledExceptionFilter(ExitWithExceptionCode);
80 |
81 | # endif
82 | #endif // GTEST_OS_WINDOWS
83 | testing::InitGoogleTest(&argc, argv);
84 |
85 | return RUN_ALL_TESTS();
86 | }
87 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-color-test_.cc:
--------------------------------------------------------------------------------
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 |
31 | // A helper program for testing how Google Test determines whether to use
32 | // colors in the output. It prints "YES" and returns 1 if Google Test
33 | // decides to use colors, and prints "NO" and returns 0 otherwise.
34 |
35 | #include
36 |
37 | #include "gtest/gtest.h"
38 | #include "src/gtest-internal-inl.h"
39 |
40 | using testing::internal::ShouldUseColor;
41 |
42 | // The purpose of this is to ensure that the UnitTest singleton is
43 | // created before main() is entered, and thus that ShouldUseColor()
44 | // works the same way as in a real Google-Test-based test. We don't actual
45 | // run the TEST itself.
46 | TEST(GTestColorTest, Dummy) {
47 | }
48 |
49 | int main(int argc, char** argv) {
50 | testing::InitGoogleTest(&argc, argv);
51 |
52 | if (ShouldUseColor(true)) {
53 | // Google Test decides to use colors in the output (assuming it
54 | // goes to a TTY).
55 | printf("YES\n");
56 | return 1;
57 | } else {
58 | // Google Test decides not to use colors in the output.
59 | printf("NO\n");
60 | return 0;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-global-environment-unittest_.cc:
--------------------------------------------------------------------------------
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 | // Unit test for Google Test global test environments.
31 | //
32 | // The program will be invoked from a Python unit test. Don't run it
33 | // directly.
34 |
35 | #include "gtest/gtest.h"
36 |
37 | namespace {
38 |
39 | // An environment that always fails in its SetUp method.
40 | class FailingEnvironment final : public ::testing::Environment {
41 | public:
42 | void SetUp() override { FAIL() << "Canned environment setup error"; }
43 | };
44 |
45 | // Register the environment.
46 | auto* const g_environment_ =
47 | ::testing::AddGlobalTestEnvironment(new FailingEnvironment);
48 |
49 | // A test that doesn't actually run.
50 | TEST(SomeTest, DoesFoo) { FAIL() << "Unexpected call"; }
51 |
52 | } // namespace
53 |
54 | int main(int argc, char** argv) {
55 | ::testing::InitGoogleTest(&argc, argv);
56 |
57 | return RUN_ALL_TESTS();
58 | }
59 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test-invalid-name1-test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2015 Google Inc. All rights reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are
7 | # met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following disclaimer
13 | # in the documentation and/or other materials provided with the
14 | # distribution.
15 | # * Neither the name of Google Inc. nor the names of its
16 | # contributors may be used to endorse or promote products derived from
17 | # this software without specific prior written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | """Verifies that Google Test warns the user when not initialized properly."""
32 |
33 | import gtest_test_utils
34 |
35 | binary_name = 'googletest-param-test-invalid-name1-test_'
36 | COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
37 |
38 |
39 | def Assert(condition):
40 | if not condition:
41 | raise AssertionError
42 |
43 |
44 | def TestExitCodeAndOutput(command):
45 | """Runs the given command and verifies its exit code and output."""
46 |
47 | err = ('Parameterized test name \'"InvalidWithQuotes"\' is invalid')
48 |
49 | p = gtest_test_utils.Subprocess(command)
50 | Assert(p.terminated_by_signal)
51 |
52 | # Verify the output message contains appropriate output
53 | Assert(err in p.output)
54 |
55 |
56 | class GTestParamTestInvalidName1Test(gtest_test_utils.TestCase):
57 |
58 | def testExitCodeAndOutput(self):
59 | TestExitCodeAndOutput(COMMAND)
60 |
61 |
62 | if __name__ == '__main__':
63 | gtest_test_utils.Main()
64 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc:
--------------------------------------------------------------------------------
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 | #include "gtest/gtest.h"
32 |
33 | namespace {
34 | class DummyTest : public ::testing::TestWithParam {};
35 |
36 | TEST_P(DummyTest, Dummy) {
37 | }
38 |
39 | INSTANTIATE_TEST_SUITE_P(InvalidTestName,
40 | DummyTest,
41 | ::testing::Values("InvalidWithQuotes"),
42 | ::testing::PrintToStringParamName());
43 |
44 | } // namespace
45 |
46 | int main(int argc, char *argv[]) {
47 | testing::InitGoogleTest(&argc, argv);
48 | return RUN_ALL_TESTS();
49 | }
50 |
51 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test-invalid-name2-test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2015 Google Inc. All rights reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are
7 | # met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following disclaimer
13 | # in the documentation and/or other materials provided with the
14 | # distribution.
15 | # * Neither the name of Google Inc. nor the names of its
16 | # contributors may be used to endorse or promote products derived from
17 | # this software without specific prior written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 |
31 | """Verifies that Google Test warns the user when not initialized properly."""
32 |
33 | import gtest_test_utils
34 |
35 | binary_name = 'googletest-param-test-invalid-name2-test_'
36 | COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
37 |
38 |
39 | def Assert(condition):
40 | if not condition:
41 | raise AssertionError
42 |
43 |
44 | def TestExitCodeAndOutput(command):
45 | """Runs the given command and verifies its exit code and output."""
46 |
47 | err = ('Duplicate parameterized test name \'a\'')
48 |
49 | p = gtest_test_utils.Subprocess(command)
50 | Assert(p.terminated_by_signal)
51 |
52 | # Check for appropriate output
53 | Assert(err in p.output)
54 |
55 |
56 | class GTestParamTestInvalidName2Test(gtest_test_utils.TestCase):
57 |
58 | def testExitCodeAndOutput(self):
59 | TestExitCodeAndOutput(COMMAND)
60 |
61 | if __name__ == '__main__':
62 | gtest_test_utils.Main()
63 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc:
--------------------------------------------------------------------------------
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 | #include "gtest/gtest.h"
32 |
33 | namespace {
34 | class DummyTest : public ::testing::TestWithParam {};
35 |
36 | std::string StringParamTestSuffix(
37 | const testing::TestParamInfo& info) {
38 | return std::string(info.param);
39 | }
40 |
41 | TEST_P(DummyTest, Dummy) {
42 | }
43 |
44 | INSTANTIATE_TEST_SUITE_P(DuplicateTestNames,
45 | DummyTest,
46 | ::testing::Values("a", "b", "a", "c"),
47 | StringParamTestSuffix);
48 | } // namespace
49 |
50 | int main(int argc, char *argv[]) {
51 | testing::InitGoogleTest(&argc, argv);
52 | return RUN_ALL_TESTS();
53 | }
54 |
55 |
56 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test-test.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 | // The Google C++ Testing and Mocking Framework (Google Test)
31 | //
32 | // This header file provides classes and functions used internally
33 | // for testing Google Test itself.
34 |
35 | #ifndef GOOGLETEST_TEST_GOOGLETEST_PARAM_TEST_TEST_H_
36 | #define GOOGLETEST_TEST_GOOGLETEST_PARAM_TEST_TEST_H_
37 |
38 | #include "gtest/gtest.h"
39 |
40 | // Test fixture for testing definition and instantiation of a test
41 | // in separate translation units.
42 | class ExternalInstantiationTest : public ::testing::TestWithParam {
43 | };
44 |
45 | // Test fixture for testing instantiation of a test in multiple
46 | // translation units.
47 | class InstantiationInMultipleTranslationUnitsTest
48 | : public ::testing::TestWithParam {
49 | };
50 |
51 | #endif // GOOGLETEST_TEST_GOOGLETEST_PARAM_TEST_TEST_H_
52 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-param-test2-test.cc:
--------------------------------------------------------------------------------
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 | //
31 | // Tests for Google Test itself. This verifies that the basic constructs of
32 | // Google Test work.
33 |
34 | #include "gtest/gtest.h"
35 | #include "test/googletest-param-test-test.h"
36 |
37 | using ::testing::Values;
38 | using ::testing::internal::ParamGenerator;
39 |
40 | // Tests that generators defined in a different translation unit
41 | // are functional. The test using extern_gen is defined
42 | // in googletest-param-test-test.cc.
43 | ParamGenerator extern_gen = Values(33);
44 |
45 | // Tests that a parameterized test case can be defined in one translation unit
46 | // and instantiated in another. The test is defined in
47 | // googletest-param-test-test.cc and ExternalInstantiationTest fixture class is
48 | // defined in gtest-param-test_test.h.
49 | INSTANTIATE_TEST_SUITE_P(MultiplesOf33,
50 | ExternalInstantiationTest,
51 | Values(33, 66));
52 |
53 | // Tests that a parameterized test case can be instantiated
54 | // in multiple translation units. Another instantiation is defined
55 | // in googletest-param-test-test.cc and
56 | // InstantiationInMultipleTranslationUnitsTest fixture is defined in
57 | // gtest-param-test_test.h
58 | INSTANTIATE_TEST_SUITE_P(Sequence2,
59 | InstantiationInMultipleTranslationUnitsTest,
60 | Values(42*3, 42*4, 42*5));
61 |
62 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-setuptestsuite-test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2019, 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 | """Verifies that SetUpTestSuite and TearDownTestSuite errors are noticed."""
33 |
34 | import gtest_test_utils
35 |
36 | COMMAND = gtest_test_utils.GetTestExecutablePath(
37 | 'googletest-setuptestsuite-test_')
38 |
39 |
40 | class GTestSetUpTestSuiteTest(gtest_test_utils.TestCase):
41 |
42 | def testSetupErrorAndTearDownError(self):
43 | p = gtest_test_utils.Subprocess(COMMAND)
44 | self.assertNotEqual(p.exit_code, 0, msg=p.output)
45 |
46 | self.assertIn(
47 | '[ FAILED ] SetupFailTest: SetUpTestSuite or TearDownTestSuite\n'
48 | '[ FAILED ] TearDownFailTest: SetUpTestSuite or TearDownTestSuite\n'
49 | '\n'
50 | ' 2 FAILED TEST SUITES\n',
51 | p.output)
52 |
53 | if __name__ == '__main__':
54 | gtest_test_utils.Main()
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-setuptestsuite-test_.cc:
--------------------------------------------------------------------------------
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 |
31 | #include "gtest/gtest.h"
32 |
33 | class SetupFailTest : public ::testing::Test {
34 | protected:
35 | static void SetUpTestSuite() {
36 | ASSERT_EQ("", "SET_UP_FAIL");
37 | }
38 | };
39 |
40 | TEST_F(SetupFailTest, NoopPassingTest) {}
41 |
42 | class TearDownFailTest : public ::testing::Test {
43 | protected:
44 | static void TearDownTestSuite() {
45 | ASSERT_EQ("", "TEAR_DOWN_FAIL");
46 | }
47 | };
48 |
49 | TEST_F(TearDownFailTest, NoopPassingTest) {}
50 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-shuffle-test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Verifies that test shuffling works.
32 |
33 | #include "gtest/gtest.h"
34 |
35 | namespace {
36 |
37 | using ::testing::EmptyTestEventListener;
38 | using ::testing::InitGoogleTest;
39 | using ::testing::Message;
40 | using ::testing::Test;
41 | using ::testing::TestEventListeners;
42 | using ::testing::TestInfo;
43 | using ::testing::UnitTest;
44 |
45 | // The test methods are empty, as the sole purpose of this program is
46 | // to print the test names before/after shuffling.
47 |
48 | class A : public Test {};
49 | TEST_F(A, A) {}
50 | TEST_F(A, B) {}
51 |
52 | TEST(ADeathTest, A) {}
53 | TEST(ADeathTest, B) {}
54 | TEST(ADeathTest, C) {}
55 |
56 | TEST(B, A) {}
57 | TEST(B, B) {}
58 | TEST(B, C) {}
59 | TEST(B, DISABLED_D) {}
60 | TEST(B, DISABLED_E) {}
61 |
62 | TEST(BDeathTest, A) {}
63 | TEST(BDeathTest, B) {}
64 |
65 | TEST(C, A) {}
66 | TEST(C, B) {}
67 | TEST(C, C) {}
68 | TEST(C, DISABLED_D) {}
69 |
70 | TEST(CDeathTest, A) {}
71 |
72 | TEST(DISABLED_D, A) {}
73 | TEST(DISABLED_D, DISABLED_B) {}
74 |
75 | // This printer prints the full test names only, starting each test
76 | // iteration with a "----" marker.
77 | class TestNamePrinter : public EmptyTestEventListener {
78 | public:
79 | void OnTestIterationStart(const UnitTest& /* unit_test */,
80 | int /* iteration */) override {
81 | printf("----\n");
82 | }
83 |
84 | void OnTestStart(const TestInfo& test_info) override {
85 | printf("%s.%s\n", test_info.test_suite_name(), test_info.name());
86 | }
87 | };
88 |
89 | } // namespace
90 |
91 | int main(int argc, char **argv) {
92 | InitGoogleTest(&argc, argv);
93 |
94 | // Replaces the default printer with TestNamePrinter, which prints
95 | // the test name only.
96 | TestEventListeners& listeners = UnitTest::GetInstance()->listeners();
97 | delete listeners.Release(listeners.default_result_printer());
98 | listeners.Append(new TestNamePrinter);
99 |
100 | return RUN_ALL_TESTS();
101 | }
102 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-throw-on-failure-test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Tests Google Test's throw-on-failure mode with exceptions disabled.
32 | //
33 | // This program must be compiled with exceptions disabled. It will be
34 | // invoked by googletest-throw-on-failure-test.py, and is expected to exit
35 | // with non-zero in the throw-on-failure mode or 0 otherwise.
36 |
37 | #include "gtest/gtest.h"
38 |
39 | #include // for fflush, fprintf, NULL, etc.
40 | #include // for exit
41 | #include // for set_terminate
42 |
43 | // This terminate handler aborts the program using exit() rather than abort().
44 | // This avoids showing pop-ups on Windows systems and core dumps on Unix-like
45 | // ones.
46 | void TerminateHandler() {
47 | fprintf(stderr, "%s\n", "Unhandled C++ exception terminating the program.");
48 | fflush(nullptr);
49 | exit(1);
50 | }
51 |
52 | int main(int argc, char** argv) {
53 | #if GTEST_HAS_EXCEPTIONS
54 | std::set_terminate(&TerminateHandler);
55 | #endif
56 | testing::InitGoogleTest(&argc, argv);
57 |
58 | // We want to ensure that people can use Google Test assertions in
59 | // other testing frameworks, as long as they initialize Google Test
60 | // properly and set the throw-on-failure mode. Therefore, we don't
61 | // use Google Test's constructs for defining and running tests
62 | // (e.g. TEST and RUN_ALL_TESTS) here.
63 |
64 | // In the throw-on-failure mode with exceptions disabled, this
65 | // assertion will cause the program to exit with a non-zero code.
66 | EXPECT_EQ(2, 3);
67 |
68 | // When not in the throw-on-failure mode, the control will reach
69 | // here.
70 | return 0;
71 | }
72 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-uninitialized-test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
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 | """Verifies that Google Test warns the user when not initialized properly."""
33 |
34 | import gtest_test_utils
35 |
36 | COMMAND = gtest_test_utils.GetTestExecutablePath('googletest-uninitialized-test_')
37 |
38 |
39 | def Assert(condition):
40 | if not condition:
41 | raise AssertionError
42 |
43 |
44 | def AssertEq(expected, actual):
45 | if expected != actual:
46 | print('Expected: %s' % (expected,))
47 | print(' Actual: %s' % (actual,))
48 | raise AssertionError
49 |
50 |
51 | def TestExitCodeAndOutput(command):
52 | """Runs the given command and verifies its exit code and output."""
53 |
54 | # Verifies that 'command' exits with code 1.
55 | p = gtest_test_utils.Subprocess(command)
56 | if p.exited and p.exit_code == 0:
57 | Assert('IMPORTANT NOTICE' in p.output);
58 | Assert('InitGoogleTest' in p.output)
59 |
60 |
61 | class GTestUninitializedTest(gtest_test_utils.TestCase):
62 | def testExitCodeAndOutput(self):
63 | TestExitCodeAndOutput(COMMAND)
64 |
65 |
66 | if __name__ == '__main__':
67 | gtest_test_utils.Main()
68 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/googletest-uninitialized-test_.cc:
--------------------------------------------------------------------------------
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 |
31 | #include "gtest/gtest.h"
32 |
33 | TEST(DummyTest, Dummy) {
34 | // This test doesn't verify anything. We just need it to create a
35 | // realistic stage for testing the behavior of Google Test when
36 | // RUN_ALL_TESTS() is called without
37 | // testing::InitGoogleTest() being called first.
38 | }
39 |
40 | int main() {
41 | return RUN_ALL_TESTS();
42 | }
43 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest-typed-test2_test.cc:
--------------------------------------------------------------------------------
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 |
31 | #include
32 |
33 | #include "test/gtest-typed-test_test.h"
34 | #include "gtest/gtest.h"
35 |
36 | // Tests that the same type-parameterized test case can be
37 | // instantiated in different translation units linked together.
38 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.)
39 | INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest,
40 | testing::Types >);
41 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest-typed-test_test.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 | #ifndef GOOGLETEST_TEST_GTEST_TYPED_TEST_TEST_H_
31 | #define GOOGLETEST_TEST_GTEST_TYPED_TEST_TEST_H_
32 |
33 | #include "gtest/gtest.h"
34 |
35 | using testing::Test;
36 |
37 | // For testing that the same type-parameterized test case can be
38 | // instantiated in different translation units linked together.
39 | // ContainerTest will be instantiated in both gtest-typed-test_test.cc
40 | // and gtest-typed-test2_test.cc.
41 |
42 | template
43 | class ContainerTest : public Test {
44 | };
45 |
46 | TYPED_TEST_SUITE_P(ContainerTest);
47 |
48 | TYPED_TEST_P(ContainerTest, CanBeDefaultConstructed) {
49 | TypeParam container;
50 | }
51 |
52 | TYPED_TEST_P(ContainerTest, InitialSizeIsZero) {
53 | TypeParam container;
54 | EXPECT_EQ(0U, container.size());
55 | }
56 |
57 | REGISTER_TYPED_TEST_SUITE_P(ContainerTest,
58 | CanBeDefaultConstructed, InitialSizeIsZero);
59 |
60 | #endif // GOOGLETEST_TEST_GTEST_TYPED_TEST_TEST_H_
61 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_all_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Tests for Google C++ Testing and Mocking Framework (Google Test)
32 | //
33 | // Sometimes it's desirable to build most of Google Test's own tests
34 | // by compiling a single file. This file serves this purpose.
35 | #include "test/googletest-filepath-test.cc"
36 | #include "test/googletest-message-test.cc"
37 | #include "test/googletest-options-test.cc"
38 | #include "test/googletest-port-test.cc"
39 | #include "test/googletest-test-part-test.cc"
40 | #include "test/gtest-typed-test2_test.cc"
41 | #include "test/gtest-typed-test_test.cc"
42 | #include "test/gtest_pred_impl_unittest.cc"
43 | #include "test/gtest_prod_test.cc"
44 | #include "test/gtest_skip_test.cc"
45 | #include "test/gtest_unittest.cc"
46 | #include "test/production.cc"
47 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_help_test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // This program is meant to be run by gtest_help_test.py. Do not run
32 | // it directly.
33 |
34 | #include "gtest/gtest.h"
35 |
36 | // When a help flag is specified, this program should skip the tests
37 | // and exit with 0; otherwise the following test will be executed,
38 | // causing this program to exit with a non-zero code.
39 | TEST(HelpFlagTest, ShouldNotBeRun) {
40 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified.";
41 | }
42 |
43 | #if GTEST_HAS_DEATH_TEST
44 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {}
45 | #endif
46 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_json_test_utils.py:
--------------------------------------------------------------------------------
1 | # Copyright 2018, 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 | """Unit test utilities for gtest_json_output."""
31 |
32 | import re
33 |
34 |
35 | def normalize(obj):
36 | """Normalize output object.
37 |
38 | Args:
39 | obj: Google Test's JSON output object to normalize.
40 |
41 | Returns:
42 | Normalized output without any references to transient information that may
43 | change from run to run.
44 | """
45 | def _normalize(key, value):
46 | if key == 'time':
47 | return re.sub(r'^\d+(\.\d+)?s$', '*', value)
48 | elif key == 'timestamp':
49 | return re.sub(r'^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ$', '*', value)
50 | elif key == 'failure':
51 | value = re.sub(r'^.*[/\\](.*:)\d+\n', '\\1*\n', value)
52 | return re.sub(r'Stack trace:\n(.|\n)*', 'Stack trace:\n*', value)
53 | else:
54 | return normalize(value)
55 | if isinstance(obj, dict):
56 | return {k: _normalize(k, v) for k, v in obj.items()}
57 | if isinstance(obj, list):
58 | return [normalize(x) for x in obj]
59 | else:
60 | return obj
61 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_list_output_unittest_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2018, 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: david.schuldenfrei@gmail.com (David Schuldenfrei)
31 |
32 | // Unit test for Google Test's --gtest_list_tests and --gtest_output flag.
33 | //
34 | // A user can ask Google Test to list all tests that will run,
35 | // and have the output saved in a Json/Xml file.
36 | // The tests will not be run after listing.
37 | //
38 | // This program will be invoked from a Python unit test.
39 | // Don't run it directly.
40 |
41 | #include "gtest/gtest.h"
42 |
43 | TEST(FooTest, Test1) {}
44 |
45 | TEST(FooTest, Test2) {}
46 |
47 | class FooTestFixture : public ::testing::Test {};
48 | TEST_F(FooTestFixture, Test3) {}
49 | TEST_F(FooTestFixture, Test4) {}
50 |
51 | class ValueParamTest : public ::testing::TestWithParam {};
52 | TEST_P(ValueParamTest, Test5) {}
53 | TEST_P(ValueParamTest, Test6) {}
54 | INSTANTIATE_TEST_SUITE_P(ValueParam, ValueParamTest, ::testing::Values(33, 42));
55 |
56 | template
57 | class TypedTest : public ::testing::Test {};
58 | typedef testing::Types TypedTestTypes;
59 | TYPED_TEST_SUITE(TypedTest, TypedTestTypes);
60 | TYPED_TEST(TypedTest, Test7) {}
61 | TYPED_TEST(TypedTest, Test8) {}
62 |
63 | template
64 | class TypeParameterizedTestSuite : public ::testing::Test {};
65 | TYPED_TEST_SUITE_P(TypeParameterizedTestSuite);
66 | TYPED_TEST_P(TypeParameterizedTestSuite, Test9) {}
67 | TYPED_TEST_P(TypeParameterizedTestSuite, Test10) {}
68 | REGISTER_TYPED_TEST_SUITE_P(TypeParameterizedTestSuite, Test9, Test10);
69 | typedef testing::Types TypeParameterizedTestSuiteTypes; // NOLINT
70 | INSTANTIATE_TYPED_TEST_SUITE_P(Single, TypeParameterizedTestSuite,
71 | TypeParameterizedTestSuiteTypes);
72 |
73 | int main(int argc, char **argv) {
74 | ::testing::InitGoogleTest(&argc, argv);
75 |
76 | return RUN_ALL_TESTS();
77 | }
78 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_main_unittest.cc:
--------------------------------------------------------------------------------
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 |
31 | #include "gtest/gtest.h"
32 |
33 | // Tests that we don't have to define main() when we link to
34 | // gtest_main instead of gtest.
35 |
36 | namespace {
37 |
38 | TEST(GTestMainTest, ShouldSucceed) {
39 | }
40 |
41 | } // namespace
42 |
43 | // We are using the main() function defined in gtest_main.cc, so we
44 | // don't define it here.
45 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_no_test_unittest.cc:
--------------------------------------------------------------------------------
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 | // Tests that a Google Test program that has no test defined can run
31 | // successfully.
32 |
33 | #include "gtest/gtest.h"
34 |
35 | int main(int argc, char **argv) {
36 | testing::InitGoogleTest(&argc, argv);
37 |
38 | // An ad-hoc assertion outside of all tests.
39 | //
40 | // This serves three purposes:
41 | //
42 | // 1. It verifies that an ad-hoc assertion can be executed even if
43 | // no test is defined.
44 | // 2. It verifies that a failed ad-hoc assertion causes the test
45 | // program to fail.
46 | // 3. We had a bug where the XML output won't be generated if an
47 | // assertion is executed before RUN_ALL_TESTS() is called, even
48 | // though --gtest_output=xml is specified. This makes sure the
49 | // bug is fixed and doesn't regress.
50 | EXPECT_EQ(1, 2);
51 |
52 | // The above EXPECT_EQ() should cause RUN_ALL_TESTS() to return non-zero.
53 | return RUN_ALL_TESTS() ? 0 : 1;
54 | }
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_prod_test.cc:
--------------------------------------------------------------------------------
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 | //
31 | // Unit test for gtest_prod.h.
32 |
33 | #include "production.h"
34 | #include "gtest/gtest.h"
35 |
36 | // Tests that private members can be accessed from a TEST declared as
37 | // a friend of the class.
38 | TEST(PrivateCodeTest, CanAccessPrivateMembers) {
39 | PrivateCode a;
40 | EXPECT_EQ(0, a.x_);
41 |
42 | a.set_x(1);
43 | EXPECT_EQ(1, a.x_);
44 | }
45 |
46 | typedef testing::Test PrivateCodeFixtureTest;
47 |
48 | // Tests that private members can be accessed from a TEST_F declared
49 | // as a friend of the class.
50 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) {
51 | PrivateCode a;
52 | EXPECT_EQ(0, a.x_);
53 |
54 | a.set_x(2);
55 | EXPECT_EQ(2, a.x_);
56 | }
57 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_skip_check_output_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2019 Google LLC. All Rights Reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are
7 | # met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following disclaimer
13 | # in the documentation and/or other materials provided with the
14 | # distribution.
15 | # * Neither the name of Google Inc. nor the names of its
16 | # contributors may be used to endorse or promote products derived from
17 | # this software without specific prior written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | """Tests Google Test's gtest skip in environment setup behavior.
31 |
32 | This script invokes gtest_skip_in_environment_setup_test_ and verifies its
33 | output.
34 | """
35 |
36 | import re
37 |
38 | import gtest_test_utils
39 |
40 | # Path to the gtest_skip_in_environment_setup_test binary
41 | EXE_PATH = gtest_test_utils.GetTestExecutablePath('gtest_skip_test')
42 |
43 | OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
44 |
45 |
46 | # Test.
47 | class SkipEntireEnvironmentTest(gtest_test_utils.TestCase):
48 |
49 | def testSkipEntireEnvironmentTest(self):
50 | self.assertIn('Skipped\nskipping single test\n', OUTPUT)
51 | skip_fixture = 'Skipped\nskipping all tests for this fixture\n'
52 | self.assertIsNotNone(
53 | re.search(skip_fixture + '.*' + skip_fixture, OUTPUT, flags=re.DOTALL),
54 | repr(OUTPUT))
55 | self.assertNotIn('FAILED', OUTPUT)
56 |
57 |
58 | if __name__ == '__main__':
59 | gtest_test_utils.Main()
60 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_skip_environment_check_output_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2019 Google LLC. All Rights Reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are
7 | # met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following disclaimer
13 | # in the documentation and/or other materials provided with the
14 | # distribution.
15 | # * Neither the name of Google Inc. nor the names of its
16 | # contributors may be used to endorse or promote products derived from
17 | # this software without specific prior written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | """Tests Google Test's gtest skip in environment setup behavior.
31 |
32 | This script invokes gtest_skip_in_environment_setup_test_ and verifies its
33 | output.
34 | """
35 |
36 | import gtest_test_utils
37 |
38 | # Path to the gtest_skip_in_environment_setup_test binary
39 | EXE_PATH = gtest_test_utils.GetTestExecutablePath(
40 | 'gtest_skip_in_environment_setup_test')
41 |
42 | OUTPUT = gtest_test_utils.Subprocess([EXE_PATH]).output
43 |
44 |
45 | # Test.
46 | class SkipEntireEnvironmentTest(gtest_test_utils.TestCase):
47 |
48 | def testSkipEntireEnvironmentTest(self):
49 | self.assertIn('Skipping the entire environment', OUTPUT)
50 | self.assertNotIn('FAILED', OUTPUT)
51 |
52 |
53 | if __name__ == '__main__':
54 | gtest_test_utils.Main()
55 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2019, Google LLC.
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 LLC. 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 test verifies that skipping in the environment results in the
31 | // testcases being skipped.
32 |
33 | #include
34 | #include "gtest/gtest.h"
35 |
36 | class SetupEnvironment : public testing::Environment {
37 | public:
38 | void SetUp() override { GTEST_SKIP() << "Skipping the entire environment"; }
39 | };
40 |
41 | TEST(Test, AlwaysFails) { EXPECT_EQ(true, false); }
42 |
43 | int main(int argc, char **argv) {
44 | testing::InitGoogleTest(&argc, argv);
45 |
46 | testing::AddGlobalTestEnvironment(new SetupEnvironment());
47 |
48 | return RUN_ALL_TESTS();
49 | }
50 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_skip_test.cc:
--------------------------------------------------------------------------------
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: arseny.aprelev@gmail.com (Arseny Aprelev)
31 | //
32 |
33 | #include "gtest/gtest.h"
34 |
35 | using ::testing::Test;
36 |
37 | TEST(SkipTest, DoesSkip) {
38 | GTEST_SKIP() << "skipping single test";
39 | EXPECT_EQ(0, 1);
40 | }
41 |
42 | class Fixture : public Test {
43 | protected:
44 | void SetUp() override {
45 | GTEST_SKIP() << "skipping all tests for this fixture";
46 | }
47 | };
48 |
49 | TEST_F(Fixture, SkipsOneTest) {
50 | EXPECT_EQ(5, 7);
51 | }
52 |
53 | TEST_F(Fixture, SkipsAnotherTest) {
54 | EXPECT_EQ(99, 100);
55 | }
56 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_sole_header_test.cc:
--------------------------------------------------------------------------------
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 | //
31 | // This test verifies that it's possible to use Google Test by including
32 | // the gtest.h header file alone.
33 |
34 | #include "gtest/gtest.h"
35 |
36 | namespace {
37 |
38 | void Subroutine() {
39 | EXPECT_EQ(42, 42);
40 | }
41 |
42 | TEST(NoFatalFailureTest, ExpectNoFatalFailure) {
43 | EXPECT_NO_FATAL_FAILURE(;);
44 | EXPECT_NO_FATAL_FAILURE(SUCCEED());
45 | EXPECT_NO_FATAL_FAILURE(Subroutine());
46 | EXPECT_NO_FATAL_FAILURE({ SUCCEED(); });
47 | }
48 |
49 | TEST(NoFatalFailureTest, AssertNoFatalFailure) {
50 | ASSERT_NO_FATAL_FAILURE(;);
51 | ASSERT_NO_FATAL_FAILURE(SUCCEED());
52 | ASSERT_NO_FATAL_FAILURE(Subroutine());
53 | ASSERT_NO_FATAL_FAILURE({ SUCCEED(); });
54 | }
55 |
56 | } // namespace
57 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_testbridge_test.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright 2018 Google LLC. All rights reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are
7 | # met:
8 | #
9 | # * Redistributions of source code must retain the above copyright
10 | # notice, this list of conditions and the following disclaimer.
11 | # * Redistributions in binary form must reproduce the above
12 | # copyright notice, this list of conditions and the following disclaimer
13 | # in the documentation and/or other materials provided with the
14 | # distribution.
15 | # * Neither the name of Google Inc. nor the names of its
16 | # contributors may be used to endorse or promote products derived from
17 | # this software without specific prior written permission.
18 | #
19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | """Verifies that Google Test uses filter provided via testbridge."""
31 |
32 | import os
33 |
34 | import gtest_test_utils
35 |
36 | binary_name = 'gtest_testbridge_test_'
37 | COMMAND = gtest_test_utils.GetTestExecutablePath(binary_name)
38 | TESTBRIDGE_NAME = 'TESTBRIDGE_TEST_ONLY'
39 |
40 |
41 | def Assert(condition):
42 | if not condition:
43 | raise AssertionError
44 |
45 |
46 | class GTestTestFilterTest(gtest_test_utils.TestCase):
47 |
48 | def testTestExecutionIsFiltered(self):
49 | """Tests that the test filter is picked up from the testbridge env var."""
50 | subprocess_env = os.environ.copy()
51 |
52 | subprocess_env[TESTBRIDGE_NAME] = '*.TestThatSucceeds'
53 | p = gtest_test_utils.Subprocess(COMMAND, env=subprocess_env)
54 |
55 | self.assertEquals(0, p.exit_code)
56 |
57 | Assert('filter = *.TestThatSucceeds' in p.output)
58 | Assert('[ OK ] TestFilterTest.TestThatSucceeds' in p.output)
59 | Assert('[ PASSED ] 1 test.' in p.output)
60 |
61 |
62 | if __name__ == '__main__':
63 | gtest_test_utils.Main()
64 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_testbridge_test_.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2018, Google LLC.
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 | // This program is meant to be run by gtest_test_filter_test.py. Do not run
32 | // it directly.
33 |
34 | #include "gtest/gtest.h"
35 |
36 | // These tests are used to detect if filtering is working. Only
37 | // 'TestThatSucceeds' should ever run.
38 |
39 | TEST(TestFilterTest, TestThatSucceeds) {}
40 |
41 | TEST(TestFilterTest, TestThatFails) {
42 | ASSERT_TRUE(false) << "This test should never be run.";
43 | }
44 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_throw_on_failure_ex_test.cc:
--------------------------------------------------------------------------------
1 | // Copyright 2009, 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 | // Tests Google Test's throw-on-failure mode with exceptions enabled.
32 |
33 | #include "gtest/gtest.h"
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | // Prints the given failure message and exits the program with
41 | // non-zero. We use this instead of a Google Test assertion to
42 | // indicate a failure, as the latter is been tested and cannot be
43 | // relied on.
44 | void Fail(const char* msg) {
45 | printf("FAILURE: %s\n", msg);
46 | fflush(stdout);
47 | exit(1);
48 | }
49 |
50 | // Tests that an assertion failure throws a subclass of
51 | // std::runtime_error.
52 | void TestFailureThrowsRuntimeError() {
53 | GTEST_FLAG_SET(throw_on_failure, true);
54 |
55 | // A successful assertion shouldn't throw.
56 | try {
57 | EXPECT_EQ(3, 3);
58 | } catch(...) {
59 | Fail("A successful assertion wrongfully threw.");
60 | }
61 |
62 | // A failed assertion should throw a subclass of std::runtime_error.
63 | try {
64 | EXPECT_EQ(2, 3) << "Expected failure";
65 | } catch(const std::runtime_error& e) {
66 | if (strstr(e.what(), "Expected failure") != nullptr) return;
67 |
68 | printf("%s",
69 | "A failed assertion did throw an exception of the right type, "
70 | "but the message is incorrect. Instead of containing \"Expected "
71 | "failure\", it is:\n");
72 | Fail(e.what());
73 | } catch(...) {
74 | Fail("A failed assertion threw the wrong type of exception.");
75 | }
76 | Fail("A failed assertion should've thrown but didn't.");
77 | }
78 |
79 | int main(int argc, char** argv) {
80 | testing::InitGoogleTest(&argc, argv);
81 |
82 | // We want to ensure that people can use Google Test assertions in
83 | // other testing frameworks, as long as they initialize Google Test
84 | // properly and set the thrown-on-failure mode. Therefore, we don't
85 | // use Google Test's constructs for defining and running tests
86 | // (e.g. TEST and RUN_ALL_TESTS) here.
87 |
88 | TestFailureThrowsRuntimeError();
89 | return 0;
90 | }
91 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_xml_outfile1_test_.cc:
--------------------------------------------------------------------------------
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 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by
31 | // gtest_xml_outfiles_test.py
32 |
33 | #include "gtest/gtest.h"
34 |
35 | class PropertyOne : public testing::Test {
36 | protected:
37 | void SetUp() override { RecordProperty("SetUpProp", 1); }
38 | void TearDown() override { RecordProperty("TearDownProp", 1); }
39 | };
40 |
41 | TEST_F(PropertyOne, TestSomeProperties) {
42 | RecordProperty("TestSomeProperty", 1);
43 | }
44 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/gtest_xml_outfile2_test_.cc:
--------------------------------------------------------------------------------
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 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by
31 | // gtest_xml_outfiles_test.py
32 |
33 | #include "gtest/gtest.h"
34 |
35 | class PropertyTwo : public testing::Test {
36 | protected:
37 | void SetUp() override { RecordProperty("SetUpProp", 2); }
38 | void TearDown() override { RecordProperty("TearDownProp", 2); }
39 | };
40 |
41 | TEST_F(PropertyTwo, TestSomeProperties) {
42 | RecordProperty("TestSomeProperty", 2);
43 | }
44 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/production.cc:
--------------------------------------------------------------------------------
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 | //
31 | // This is part of the unit test for gtest_prod.h.
32 |
33 | #include "production.h"
34 |
35 | PrivateCode::PrivateCode() : x_(0) {}
36 |
--------------------------------------------------------------------------------
/thirdparty/googletest/googletest/test/production.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 | //
31 | // This is part of the unit test for gtest_prod.h.
32 |
33 | #ifndef GOOGLETEST_TEST_PRODUCTION_H_
34 | #define GOOGLETEST_TEST_PRODUCTION_H_
35 |
36 | #include "gtest/gtest_prod.h"
37 |
38 | class PrivateCode {
39 | public:
40 | // Declares a friend test that does not use a fixture.
41 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers);
42 |
43 | // Declares a friend test that uses a fixture.
44 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers);
45 |
46 | PrivateCode();
47 |
48 | int x() const { return x_; }
49 | private:
50 | void set_x(int an_x) { x_ = an_x; }
51 | int x_;
52 | };
53 |
54 | #endif // GOOGLETEST_TEST_PRODUCTION_H_
55 |
--------------------------------------------------------------------------------