Path: blob/main/contrib/googletest/googlemock/include/gmock/gmock.h
48378 views
// Copyright 2007, Google Inc.1// All rights reserved.2//3// Redistribution and use in source and binary forms, with or without4// modification, are permitted provided that the following conditions are5// met:6//7// * Redistributions of source code must retain the above copyright8// notice, this list of conditions and the following disclaimer.9// * Redistributions in binary form must reproduce the above10// copyright notice, this list of conditions and the following disclaimer11// in the documentation and/or other materials provided with the12// distribution.13// * Neither the name of Google Inc. nor the names of its14// contributors may be used to endorse or promote products derived from15// this software without specific prior written permission.16//17// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS18// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT19// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR20// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT21// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,22// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT23// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,24// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY25// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT26// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE27// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.2829// Google Mock - a framework for writing C++ mock classes.30//31// This is the main header file a user should include.3233#ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_34#define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_3536// This file implements the following syntax:37//38// ON_CALL(mock_object, Method(...))39// .With(...) ?40// .WillByDefault(...);41//42// where With() is optional and WillByDefault() must appear exactly43// once.44//45// EXPECT_CALL(mock_object, Method(...))46// .With(...) ?47// .Times(...) ?48// .InSequence(...) *49// .WillOnce(...) *50// .WillRepeatedly(...) ?51// .RetiresOnSaturation() ? ;52//53// where all clauses are optional and WillOnce() can be repeated.5455#include "gmock/gmock-actions.h" // IWYU pragma: export56#include "gmock/gmock-cardinalities.h" // IWYU pragma: export57#include "gmock/gmock-function-mocker.h" // IWYU pragma: export58#include "gmock/gmock-matchers.h" // IWYU pragma: export59#include "gmock/gmock-more-actions.h" // IWYU pragma: export60#include "gmock/gmock-more-matchers.h" // IWYU pragma: export61#include "gmock/gmock-nice-strict.h" // IWYU pragma: export62#include "gmock/gmock-spec-builders.h" // IWYU pragma: export63#include "gmock/internal/gmock-internal-utils.h"64#include "gmock/internal/gmock-port.h"6566// Declares Google Mock flags that we want a user to use programmatically.67GMOCK_DECLARE_bool_(catch_leaked_mocks);68GMOCK_DECLARE_string_(verbose);69GMOCK_DECLARE_int32_(default_mock_behavior);7071namespace testing {7273// Initializes Google Mock. This must be called before running the74// tests. In particular, it parses the command line for the flags75// that Google Mock recognizes. Whenever a Google Mock flag is seen,76// it is removed from argv, and *argc is decremented.77//78// No value is returned. Instead, the Google Mock flag variables are79// updated.80//81// Since Google Test is needed for Google Mock to work, this function82// also initializes Google Test and parses its flags, if that hasn't83// been done.84GTEST_API_ void InitGoogleMock(int* argc, char** argv);8586// This overloaded version can be used in Windows programs compiled in87// UNICODE mode.88GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);8990// This overloaded version can be used on Arduino/embedded platforms where91// there is no argc/argv.92GTEST_API_ void InitGoogleMock();9394} // namespace testing9596#endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_H_979899