Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Shameek Ganguly <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
  • Loading branch information
mjcarroll and shameekganguly authored Nov 22, 2024
1 parent c9b4aec commit 6baa9e3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/gz/utils/ExtraTestMacros.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#define GZ_UTILS_TEST_ENABLED_ONLY_ON_WINDOWS(TestName) \
DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_WIN32(TestName)

/// Other platforms will get the test compiled but it won't be run
/// \brief Restrict the execution of the test to just the Windows platform
/// Other platforms will get the test compiled but it won't be run
/// as part of the test suite execution.
/// The macro uses the Disabled_ prefix provided by googletest. See
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
Expand Down
46 changes: 36 additions & 10 deletions src/ExtraTestMacros_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,76 @@

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_ENABLED_ONLY_ON_WIN32(OnlyWindowsOn))
{
ASSERT_TRUE(true);
#if defined __APPLE__
ADD_FAILURE() << "Windows only test on Apple platform";
#elif defined __linux__
ADD_FAILURE() << "Windows only test on Linux platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_DISABLED_ON_WIN32(OnlyWindowsOff))
{
ASSERT_TRUE(true);
#if defined __WIN32
ADD_FAILURE() << "Ran on Windows platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_ENABLED_ONLY_ON_MAC(OnlyMacOn))
{
ASSERT_TRUE(true);
#if defined _WIN32
ADD_FAILURE() << "Apple only test on Windows platform";
#elif defined __linux__
ADD_FAILURE() << "Apple only test on Linux platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_DISABLED_ON_MAC(OnlyMacOff))
{
ASSERT_TRUE(true);
#if defined __APPLE__
ADD_FAILURE() << "Ran on Apple platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(OnlyLinuxOn))
{
ASSERT_TRUE(true);
#if defined _WIN32
ADD_FAILURE() << "Linux only test on Windows platform";
#elif defined __APPLE__
ADD_FAILURE() << "Linux only test on Apple platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_DISABLED_ON_LINUX(OnlyLinuxOff))
{
ASSERT_TRUE(true);
#if defined __linux__
ADD_FAILURE() << "Ran on Linux platform";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_ENABLED_ONLY_ON_ARM32(OnlyArm32On))
{
ASSERT_TRUE(true);
#if defined __aarch64__ || defined _M_ARM64
ADD_FAILURE() << "Ran on Arm64 arch";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_DISABLED_ON_ARM32(OnlyArm32Off))
{
ASSERT_TRUE(true);
#if defined __arm__ || defined _M_ARM
ADD_FAILURE() << "Ran on Arm32 arch";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_ENABLED_ONLY_ON_ARM64(OnlyArm64On))
{
ASSERT_TRUE(true);
#if defined __arm__ || defined _M_ARM
ADD_FAILURE() << "Ran on Arm32 arch";
#endif
}

GTEST_TEST(ExtraTestMacros, GZ_UTILS_TEST_DISABLED_ON_ARM64(OnlyArm64Off))
{
ASSERT_TRUE(true);
#if defined __aarch64__ || defined _M_ARM64
ADD_FAILURE() << "Ran on Arm64 arch";
#endif
}

0 comments on commit 6baa9e3

Please sign in to comment.