xref: /llvm-project/third-party/unittest/googlemock/include/gmock/gmock.h (revision a866ce789eb99da4d7a486eeb60a53be6c75f4fd)
1a11cd0d9STom Stellard // Copyright 2007, Google Inc.
2a11cd0d9STom Stellard // All rights reserved.
3a11cd0d9STom Stellard //
4a11cd0d9STom Stellard // Redistribution and use in source and binary forms, with or without
5a11cd0d9STom Stellard // modification, are permitted provided that the following conditions are
6a11cd0d9STom Stellard // met:
7a11cd0d9STom Stellard //
8a11cd0d9STom Stellard //     * Redistributions of source code must retain the above copyright
9a11cd0d9STom Stellard // notice, this list of conditions and the following disclaimer.
10a11cd0d9STom Stellard //     * Redistributions in binary form must reproduce the above
11a11cd0d9STom Stellard // copyright notice, this list of conditions and the following disclaimer
12a11cd0d9STom Stellard // in the documentation and/or other materials provided with the
13a11cd0d9STom Stellard // distribution.
14a11cd0d9STom Stellard //     * Neither the name of Google Inc. nor the names of its
15a11cd0d9STom Stellard // contributors may be used to endorse or promote products derived from
16a11cd0d9STom Stellard // this software without specific prior written permission.
17a11cd0d9STom Stellard //
18a11cd0d9STom Stellard // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19a11cd0d9STom Stellard // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20a11cd0d9STom Stellard // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21a11cd0d9STom Stellard // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22a11cd0d9STom Stellard // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23a11cd0d9STom Stellard // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24a11cd0d9STom Stellard // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25a11cd0d9STom Stellard // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26a11cd0d9STom Stellard // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27a11cd0d9STom Stellard // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28a11cd0d9STom Stellard // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29a11cd0d9STom Stellard 
30a11cd0d9STom Stellard // Google Mock - a framework for writing C++ mock classes.
31a11cd0d9STom Stellard //
32a11cd0d9STom Stellard // This is the main header file a user should include.
33a11cd0d9STom Stellard 
34*a866ce78SHaowei Wu #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
35*a866ce78SHaowei Wu #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
36a11cd0d9STom Stellard 
37a11cd0d9STom Stellard // This file implements the following syntax:
38a11cd0d9STom Stellard //
39a11cd0d9STom Stellard //   ON_CALL(mock_object, Method(...))
40a11cd0d9STom Stellard //     .With(...) ?
41a11cd0d9STom Stellard //     .WillByDefault(...);
42a11cd0d9STom Stellard //
43a11cd0d9STom Stellard // where With() is optional and WillByDefault() must appear exactly
44a11cd0d9STom Stellard // once.
45a11cd0d9STom Stellard //
46a11cd0d9STom Stellard //   EXPECT_CALL(mock_object, Method(...))
47a11cd0d9STom Stellard //     .With(...) ?
48a11cd0d9STom Stellard //     .Times(...) ?
49a11cd0d9STom Stellard //     .InSequence(...) *
50a11cd0d9STom Stellard //     .WillOnce(...) *
51a11cd0d9STom Stellard //     .WillRepeatedly(...) ?
52a11cd0d9STom Stellard //     .RetiresOnSaturation() ? ;
53a11cd0d9STom Stellard //
54a11cd0d9STom Stellard // where all clauses are optional and WillOnce() can be repeated.
55a11cd0d9STom Stellard 
56a11cd0d9STom Stellard #include "gmock/gmock-actions.h"
57a11cd0d9STom Stellard #include "gmock/gmock-cardinalities.h"
58a11cd0d9STom Stellard #include "gmock/gmock-function-mocker.h"
59a11cd0d9STom Stellard #include "gmock/gmock-matchers.h"
60a11cd0d9STom Stellard #include "gmock/gmock-more-actions.h"
61a11cd0d9STom Stellard #include "gmock/gmock-more-matchers.h"
62a11cd0d9STom Stellard #include "gmock/gmock-nice-strict.h"
63a11cd0d9STom Stellard #include "gmock/internal/gmock-internal-utils.h"
64a11cd0d9STom Stellard #include "gmock/internal/gmock-port.h"
65a11cd0d9STom Stellard 
66a11cd0d9STom Stellard // Declares Google Mock flags that we want a user to use programmatically.
67a11cd0d9STom Stellard GMOCK_DECLARE_bool_(catch_leaked_mocks);
68a11cd0d9STom Stellard GMOCK_DECLARE_string_(verbose);
69a11cd0d9STom Stellard GMOCK_DECLARE_int32_(default_mock_behavior);
70a11cd0d9STom Stellard 
71*a866ce78SHaowei Wu namespace testing {
72*a866ce78SHaowei Wu 
73a11cd0d9STom Stellard // Initializes Google Mock.  This must be called before running the
74a11cd0d9STom Stellard // tests.  In particular, it parses the command line for the flags
75a11cd0d9STom Stellard // that Google Mock recognizes.  Whenever a Google Mock flag is seen,
76a11cd0d9STom Stellard // it is removed from argv, and *argc is decremented.
77a11cd0d9STom Stellard //
78a11cd0d9STom Stellard // No value is returned.  Instead, the Google Mock flag variables are
79a11cd0d9STom Stellard // updated.
80a11cd0d9STom Stellard //
81a11cd0d9STom Stellard // Since Google Test is needed for Google Mock to work, this function
82a11cd0d9STom Stellard // also initializes Google Test and parses its flags, if that hasn't
83a11cd0d9STom Stellard // been done.
84a11cd0d9STom Stellard GTEST_API_ void InitGoogleMock(int* argc, char** argv);
85a11cd0d9STom Stellard 
86a11cd0d9STom Stellard // This overloaded version can be used in Windows programs compiled in
87a11cd0d9STom Stellard // UNICODE mode.
88a11cd0d9STom Stellard GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
89a11cd0d9STom Stellard 
90a11cd0d9STom Stellard // This overloaded version can be used on Arduino/embedded platforms where
91a11cd0d9STom Stellard // there is no argc/argv.
92a11cd0d9STom Stellard GTEST_API_ void InitGoogleMock();
93a11cd0d9STom Stellard 
94a11cd0d9STom Stellard }  // namespace testing
95a11cd0d9STom Stellard 
96*a866ce78SHaowei Wu #endif  // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_
97