00001 // Copyright 2007, Google Inc. 00002 // All rights reserved. 00003 // 00004 // Redistribution and use in source and binary forms, with or without 00005 // modification, are permitted provided that the following conditions are 00006 // met: 00007 // 00008 // * Redistributions of source code must retain the above copyright 00009 // notice, this list of conditions and the following disclaimer. 00010 // * Redistributions in binary form must reproduce the above 00011 // copyright notice, this list of conditions and the following disclaimer 00012 // in the documentation and/or other materials provided with the 00013 // distribution. 00014 // * Neither the name of Google Inc. nor the names of its 00015 // contributors may be used to endorse or promote products derived from 00016 // this software without specific prior written permission. 00017 // 00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00021 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00022 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00023 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00024 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00025 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00026 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00028 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00029 // 00030 // Author: wan@google.com (Zhanyong Wan) 00031 00032 // Google Mock - a framework for writing C++ mock classes. 00033 // 00034 // This is the main header file a user should include. 00035 00036 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_H_ 00037 #define GMOCK_INCLUDE_GMOCK_GMOCK_H_ 00038 00039 // This file implements the following syntax: 00040 // 00041 // ON_CALL(mock_object.Method(...)) 00042 // .With(...) ? 00043 // .WillByDefault(...); 00044 // 00045 // where With() is optional and WillByDefault() must appear exactly 00046 // once. 00047 // 00048 // EXPECT_CALL(mock_object.Method(...)) 00049 // .With(...) ? 00050 // .Times(...) ? 00051 // .InSequence(...) * 00052 // .WillOnce(...) * 00053 // .WillRepeatedly(...) ? 00054 // .RetiresOnSaturation() ? ; 00055 // 00056 // where all clauses are optional and WillOnce() can be repeated. 00057 00058 #include "gmock/gmock-actions.h" 00059 #include "gmock/gmock-cardinalities.h" 00060 #include "gmock/gmock-generated-actions.h" 00061 #include "gmock/gmock-generated-function-mockers.h" 00062 #include "gmock/gmock-generated-nice-strict.h" 00063 #include "gmock/gmock-generated-matchers.h" 00064 #include "gmock/gmock-matchers.h" 00065 #include "gmock/gmock-more-actions.h" 00066 #include "gmock/gmock-more-matchers.h" 00067 #include "gmock/internal/gmock-internal-utils.h" 00068 00069 namespace testing { 00070 00071 // Declares Google Mock flags that we want a user to use programmatically. 00072 GMOCK_DECLARE_bool_(catch_leaked_mocks); 00073 GMOCK_DECLARE_string_(verbose); 00074 00075 // Initializes Google Mock. This must be called before running the 00076 // tests. In particular, it parses the command line for the flags 00077 // that Google Mock recognizes. Whenever a Google Mock flag is seen, 00078 // it is removed from argv, and *argc is decremented. 00079 // 00080 // No value is returned. Instead, the Google Mock flag variables are 00081 // updated. 00082 // 00083 // Since Google Test is needed for Google Mock to work, this function 00084 // also initializes Google Test and parses its flags, if that hasn't 00085 // been done. 00086 GTEST_API_ void InitGoogleMock(int* argc, char** argv); 00087 00088 // This overloaded version can be used in Windows programs compiled in 00089 // UNICODE mode. 00090 GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv); 00091 00092 } // namespace testing 00093 00094 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_