Path: blob/main/contrib/googletest/googlemock/src/gmock_main.cc
48254 views
// Copyright 2008, 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#include <iostream>3031#include "gmock/gmock.h"32#include "gtest/gtest.h"3334#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \35(defined(GTEST_OS_NRF52) && defined(ARDUINO))36#ifdef GTEST_OS_ESP826637extern "C" {38#endif39void setup() {40// Since Google Mock depends on Google Test, InitGoogleMock() is41// also responsible for initializing Google Test. Therefore there's42// no need for calling testing::InitGoogleTest() separately.43testing::InitGoogleMock();44}45void loop() { RUN_ALL_TESTS(); }46#ifdef GTEST_OS_ESP826647}48#endif4950#else5152// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which53// causes a link error when _tmain is defined in a static library and UNICODE54// is enabled. For this reason instead of _tmain, main function is used on55// 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-library57// // NOLINT58#ifdef GTEST_OS_WINDOWS_MOBILE59#include <tchar.h> // NOLINT6061GTEST_API_ int _tmain(int argc, TCHAR** argv) {62#else63GTEST_API_ int main(int argc, char** argv) {64#endif // GTEST_OS_WINDOWS_MOBILE65std::cout << "Running main() from gmock_main.cc\n";66// Since Google Mock depends on Google Test, InitGoogleMock() is67// also responsible for initializing Google Test. Therefore there's68// no need for calling testing::InitGoogleTest() separately.69testing::InitGoogleMock(&argc, argv);70return RUN_ALL_TESTS();71}72#endif737475