fix: Remove Arduino entry points

Improved flexibility by removing the Arduino entry points in favor of manual calls to setup/loop that the user can call from their entry point.  This is the more common use case for Arudino.

Also added the gtest/gmock_main files to the PlatformIO ignore list since we are not supporting that feature.
This commit is contained in:
Chris
2019-01-03 12:12:19 -06:00
parent de99386b67
commit 4d62b5b9ae
5 changed files with 188 additions and 228 deletions

View File

@@ -92,6 +92,22 @@ GTEST_API_ void InitGoogleMock(int* argc, char** argv);
// UNICODE mode.
GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
#ifdef ARDUINO
inline void gmock_setup() {
// Since Arduino doesn't have a command line, fake out the argc/argv arguments
int argc = 1;
const auto arg0 = "PlatformIO";
char* argv0 = const_cast<char*>(arg0);
char** argv = &argv0;
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// no need for calling testing::InitGoogleTest() separately.
testing::InitGoogleMock(&argc, argv);
}
inline void gmock_loop() { RUN_ALL_TESTS(); }
#endif
} // namespace testing
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_H_