1c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Copyright 2008, Google Inc. 2c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// All rights reserved. 3c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// 4c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Redistribution and use in source and binary forms, with or without 5c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// modification, are permitted provided that the following conditions are 6c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// met: 7c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// 8c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// * Redistributions of source code must retain the above copyright 9c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// notice, this list of conditions and the following disclaimer. 10c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// * Redistributions in binary form must reproduce the above 11c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// copyright notice, this list of conditions and the following disclaimer 12c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// in the documentation and/or other materials provided with the 13c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// distribution. 14c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// * Neither the name of Google Inc. nor the names of its 15c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// contributors may be used to endorse or promote products derived from 16c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// this software without specific prior written permission. 17c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// 18c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// 30c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Author: wan@google.com (Zhanyong Wan) 31c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 32c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#include <iostream> 33dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen#include "gmock/gmock.h" 34dc0f95d653279beabeb9817299e2902918ba123eKristian Monsen#include "gtest/gtest.h" 35c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 36c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which 37c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// causes a link error when _tmain is defined in a static library and UNICODE 38c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// is enabled. For this reason instead of _tmain, main function is used on 39c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// Windows. See the following link to track the current status of this bug: 40c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch// http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=394464 // NOLINT 41c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#if GTEST_OS_WINDOWS_MOBILE 42ddb351dbec246cf1fab5ec20d2d5520909041de1Kristian Monsen# include <tchar.h> // NOLINT 43c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch 44c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochint _tmain(int argc, TCHAR** argv) { 45c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#else 46c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdochint main(int argc, char** argv) { 47c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch#endif // GTEST_OS_WINDOWS_MOBILE 48c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch std::cout << "Running main() from gmock_main.cc\n"; 49c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // Since Google Mock depends on Google Test, InitGoogleMock() is 50c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // also responsible for initializing Google Test. Therefore there's 51c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch // no need for calling testing::InitGoogleTest() separately. 52c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch testing::InitGoogleMock(&argc, argv); 53c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch return RUN_ALL_TESTS(); 54c407dc5cd9bdc5668497f21b26b09d988ab439deBen Murdoch} 55