Files

61 lines
1.3 KiB
C++
Raw Permalink Normal View History

2024-06-27 18:28:04 +09:00
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
/*
main for UnitTest on native
*/
#include <gtest/gtest.h>
// C++ version
#if __cplusplus >= 202002L
#pragma message "C++20 or later"
#elif __cplusplus >= 201703L
#pragma message "C++17 or later"
#elif __cplusplus >= 201402L
#pragma message "C++14 or later"
#elif __cplusplus >= 201103L
#pragma message "C++11 or later"
#else
#error "Need C++11 or later"
#endif
// Compiler
#if defined(__clang__)
#pragma message "Clang"
#elif defined(_MSC_VER)
#pragma message "MSVC"
#elif defined(__BORLANDC__)
2024-05-19 22:39:57 +09:00
#pragma message "BORLANDC"
#elif defined(__MINGW32__) || defined(__MINGW64__)
#pragma message "MINGW"
#elif defined(__INTEL_COMPILER)
#pragma message "ICC"
#elif defined(__GNUG__)
#pragma message "GCC"
#else
#pragma message "Unknown compiler"
#endif
/*
For native test, this main() is used.
2024-05-20 18:35:40 +09:00
If the Arduino framework is used, the framework library main is used.
*/
2024-05-20 18:35:40 +09:00
#if !defined(ARDUINO)
2024-09-25 18:18:05 +09:00
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
#ifdef GTEST_FILTER
::testing::GTEST_FLAG(filter) = GTEST_FILTER;
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
RUN_ALL_TESTS();
#pragma GCC diagnostic pop
// Always return zero-code and allow PlatformIO to parse results
return 0;
}
2024-05-20 18:35:40 +09:00
#endif