diff options
| -rw-r--r-- | googlemock/src/gmock_main.cc | 14 | ||||
| -rw-r--r-- | googletest/src/gtest_main.cc | 14 | 
2 files changed, 28 insertions, 0 deletions
| diff --git a/googlemock/src/gmock_main.cc b/googlemock/src/gmock_main.cc index a3a271e6..3306ffcf 100644 --- a/googlemock/src/gmock_main.cc +++ b/googlemock/src/gmock_main.cc @@ -32,6 +32,18 @@  #include "gmock/gmock.h"  #include "gtest/gtest.h" +#ifdef ARDUINO +void setup() { +  int argc = 0; +  char** argv = nullptr; +  // 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); +} +void loop() { RUN_ALL_TESTS(); } +#else +  // MS C++ compiler/linker has a bug on Windows (not on Windows CE), which  // causes a link error when _tmain is defined in a static library and UNICODE  // is enabled. For this reason instead of _tmain, main function is used on @@ -52,3 +64,5 @@ GTEST_API_ int main(int argc, char** argv) {    testing::InitGoogleMock(&argc, argv);    return RUN_ALL_TESTS();  } + +#endif diff --git a/googletest/src/gtest_main.cc b/googletest/src/gtest_main.cc index 2113f621..92285a3d 100644 --- a/googletest/src/gtest_main.cc +++ b/googletest/src/gtest_main.cc @@ -30,8 +30,22 @@  #include <stdio.h>  #include "gtest/gtest.h" +#ifdef ARDUINO +void setup() { +  int argc = 0; +  char** argv = nullptr; +  testing::InitGoogleTest(&argc, argv); +} + +void loop() { RUN_ALL_TESTS(); } + +#else +  GTEST_API_ int main(int argc, char **argv) {    printf("Running main() from %s\n", __FILE__);    testing::InitGoogleTest(&argc, argv);    return RUN_ALL_TESTS();  } + +#endif + | 
