11cb0ef41Sopenharmony_ci// Copyright 2006, Google Inc. 21cb0ef41Sopenharmony_ci// All rights reserved. 31cb0ef41Sopenharmony_ci// 41cb0ef41Sopenharmony_ci// Redistribution and use in source and binary forms, with or without 51cb0ef41Sopenharmony_ci// modification, are permitted provided that the following conditions are 61cb0ef41Sopenharmony_ci// met: 71cb0ef41Sopenharmony_ci// 81cb0ef41Sopenharmony_ci// * Redistributions of source code must retain the above copyright 91cb0ef41Sopenharmony_ci// notice, this list of conditions and the following disclaimer. 101cb0ef41Sopenharmony_ci// * Redistributions in binary form must reproduce the above 111cb0ef41Sopenharmony_ci// copyright notice, this list of conditions and the following disclaimer 121cb0ef41Sopenharmony_ci// in the documentation and/or other materials provided with the 131cb0ef41Sopenharmony_ci// distribution. 141cb0ef41Sopenharmony_ci// * Neither the name of Google Inc. nor the names of its 151cb0ef41Sopenharmony_ci// contributors may be used to endorse or promote products derived from 161cb0ef41Sopenharmony_ci// this software without specific prior written permission. 171cb0ef41Sopenharmony_ci// 181cb0ef41Sopenharmony_ci// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 191cb0ef41Sopenharmony_ci// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 201cb0ef41Sopenharmony_ci// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 211cb0ef41Sopenharmony_ci// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 221cb0ef41Sopenharmony_ci// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 231cb0ef41Sopenharmony_ci// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 241cb0ef41Sopenharmony_ci// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 251cb0ef41Sopenharmony_ci// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 261cb0ef41Sopenharmony_ci// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 271cb0ef41Sopenharmony_ci// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 281cb0ef41Sopenharmony_ci// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ci#include <cstdio> 311cb0ef41Sopenharmony_ci 321cb0ef41Sopenharmony_ci#include "gtest/gtest.h" 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ci#if defined(GTEST_OS_ESP8266) || defined(GTEST_OS_ESP32) || \ 351cb0ef41Sopenharmony_ci (defined(GTEST_OS_NRF52) && defined(ARDUINO)) 361cb0ef41Sopenharmony_ci// Arduino-like platforms: program entry points are setup/loop instead of main. 371cb0ef41Sopenharmony_ci 381cb0ef41Sopenharmony_ci#ifdef GTEST_OS_ESP8266 391cb0ef41Sopenharmony_ciextern "C" { 401cb0ef41Sopenharmony_ci#endif 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_civoid setup() { testing::InitGoogleTest(); } 431cb0ef41Sopenharmony_ci 441cb0ef41Sopenharmony_civoid loop() { RUN_ALL_TESTS(); } 451cb0ef41Sopenharmony_ci 461cb0ef41Sopenharmony_ci#ifdef GTEST_OS_ESP8266 471cb0ef41Sopenharmony_ci} 481cb0ef41Sopenharmony_ci#endif 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci#elif defined(GTEST_OS_QURT) 511cb0ef41Sopenharmony_ci// QuRT: program entry point is main, but argc/argv are unusable. 521cb0ef41Sopenharmony_ci 531cb0ef41Sopenharmony_ciGTEST_API_ int main() { 541cb0ef41Sopenharmony_ci printf("Running main() from %s\n", __FILE__); 551cb0ef41Sopenharmony_ci testing::InitGoogleTest(); 561cb0ef41Sopenharmony_ci return RUN_ALL_TESTS(); 571cb0ef41Sopenharmony_ci} 581cb0ef41Sopenharmony_ci#else 591cb0ef41Sopenharmony_ci// Normal platforms: program entry point is main, argc/argv are initialized. 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_ciGTEST_API_ int main(int argc, char **argv) { 621cb0ef41Sopenharmony_ci printf("Running main() from %s\n", __FILE__); 631cb0ef41Sopenharmony_ci testing::InitGoogleTest(&argc, argv); 641cb0ef41Sopenharmony_ci return RUN_ALL_TESTS(); 651cb0ef41Sopenharmony_ci} 661cb0ef41Sopenharmony_ci#endif 67