Skip to content

Commit

Permalink
fix gtest 1.12 or later compat (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Dec 13, 2022
1 parent 30548c1 commit 56d7589
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion include/gtest/iutest_gmock_ver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@

//!< Micro Version
#ifndef GMOCK_MICROVER
# if GMOCK_MINORVER == 0x08 && !defined(GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_)
# if GMOCK_MINORVER == 0x12 && defined(GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_FUNCTION_MOCKER_H_)
# define GMOCK_MICROVER 0x01
# elif GMOCK_MINORVER == 0x08 && !defined(GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_CALLBACK_MATCHERS_H_)
# define GMOCK_MICROVER 0x01
# endif
#endif
Expand Down
4 changes: 3 additions & 1 deletion include/gtest/iutest_gtest_ver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@

//!< Micro Version
#ifndef GTEST_MICROVER
# if GTEST_MINORVER == 0x08 && defined(GTEST_STRINGIFY_)
# if GTEST_MINORVER == 0x12 && defined(GTEST_HAVE_ATTRIBUTE_)
# define GTEST_MICROVER 0x01
# elif GTEST_MINORVER == 0x08 && defined(GTEST_STRINGIFY_)
# define GTEST_MICROVER 0x01
# elif GTEST_MINORVER == 0x02 && defined(GTEST_HAS_CLONE)
# define GTEST_MICROVER 0x01
Expand Down
9 changes: 4 additions & 5 deletions test/random_seed_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ int main(int argc, char* argv[])
{
MyEnvironment* const env = new MyEnvironment();
IUTEST_TERMINATE_ON_FAILURE( ::iutest::AddGlobalTestEnvironment(env) == env );
IUTEST_INIT(&argc, argv);

#if defined(IUTEST_USE_GTEST) && (GTEST_VER >= 0x01120000)
::iutest::IUTEST_FLAG(recreate_environments_when_repeating) = true;
#endif
::iutest::IUTEST_FLAG(repeat) = kRepeatCount;
::iutest::IUTEST_FLAG(shuffle) = true;
::iutest::IUTEST_FLAG(random_seed) = kSeed;

#if defined(IUTEST_USE_GTEST) && GTEST_LATEST
::iutest::IUTEST_FLAG(recreate_environments_when_repeating) = true;
#endif
IUTEST_INIT(&argc, argv);

const int ret = IUTEST_RUN_ALL_TESTS();
if( ret != 0 ) return ret;
Expand Down
2 changes: 1 addition & 1 deletion test/repeat_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int argc, char* argv[])
IUTEST_TERMINATE_ON_FAILURE( ::iutest::AddGlobalTestEnvironment(env) == env );
IUTEST_INIT(&argc, argv);

#if defined(IUTEST_USE_GTEST) && GTEST_LATEST
#if defined(IUTEST_USE_GTEST) && (GTEST_VER >= 0x01120000)
::iutest::IUTEST_FLAG(recreate_environments_when_repeating) = true;
#endif

Expand Down
2 changes: 1 addition & 1 deletion test/shuffle_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int main(int argc, char* argv[])
::iutest::IUTEST_FLAG(repeat) = 3;
::iutest::IUTEST_FLAG(shuffle) = true;

#if defined(IUTEST_USE_GTEST) && GTEST_LATEST
#if defined(IUTEST_USE_GTEST) && (GTEST_VER >= 0x01120000)
::iutest::IUTEST_FLAG(recreate_environments_when_repeating) = true;
#endif

Expand Down

0 comments on commit 56d7589

Please sign in to comment.