diff options
Diffstat (limited to 'googletest/test')
-rw-r--r-- | googletest/test/BUILD.bazel | 3 | ||||
-rw-r--r-- | googletest/test/googletest-output-test_.cc | 8 | ||||
-rw-r--r-- | googletest/test/gtest-typed-test_test.cc | 17 | ||||
-rw-r--r-- | googletest/test/gtest_unittest.cc | 56 |
4 files changed, 18 insertions, 66 deletions
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 45dff30..156d5d4 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel @@ -32,6 +32,9 @@ # # Bazel BUILD for The Google C++ Testing Framework (Google Test) +load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_test") +load("@rules_python//python:defs.bzl", "py_library", "py_test") + licenses(["notice"]) #on windows exclude gtest-tuple.h diff --git a/googletest/test/googletest-output-test_.cc b/googletest/test/googletest-output-test_.cc index 83be568..4f716d8 100644 --- a/googletest/test/googletest-output-test_.cc +++ b/googletest/test/googletest-output-test_.cc @@ -816,9 +816,9 @@ class TypedTestNames { public: template <typename T> static std::string GetName(int i) { - if (testing::internal::IsSame<T, char>::value) + if (std::is_same<T, char>::value) return std::string("char") + ::testing::PrintToString(i); - if (testing::internal::IsSame<T, int>::value) + if (std::is_same<T, int>::value) return std::string("int") + ::testing::PrintToString(i); } }; @@ -857,10 +857,10 @@ class TypedTestPNames { public: template <typename T> static std::string GetName(int i) { - if (testing::internal::IsSame<T, unsigned char>::value) { + if (std::is_same<T, unsigned char>::value) { return std::string("unsignedChar") + ::testing::PrintToString(i); } - if (testing::internal::IsSame<T, unsigned int>::value) { + if (std::is_same<T, unsigned int>::value) { return std::string("unsignedInt") + ::testing::PrintToString(i); } } diff --git a/googletest/test/gtest-typed-test_test.cc b/googletest/test/gtest-typed-test_test.cc index f1ca937..5411832 100644 --- a/googletest/test/gtest-typed-test_test.cc +++ b/googletest/test/gtest-typed-test_test.cc @@ -31,6 +31,7 @@ #include "test/gtest-typed-test_test.h" #include <set> +#include <type_traits> #include <vector> #include "gtest/gtest.h" @@ -177,10 +178,10 @@ class TypedTestNames { public: template <typename T> static std::string GetName(int i) { - if (testing::internal::IsSame<T, char>::value) { + if (std::is_same<T, char>::value) { return std::string("char") + ::testing::PrintToString(i); } - if (testing::internal::IsSame<T, int>::value) { + if (std::is_same<T, int>::value) { return std::string("int") + ::testing::PrintToString(i); } } @@ -189,13 +190,13 @@ class TypedTestNames { TYPED_TEST_SUITE(TypedTestWithNames, TwoTypes, TypedTestNames); TYPED_TEST(TypedTestWithNames, TestSuiteName) { - if (testing::internal::IsSame<TypeParam, char>::value) { + if (std::is_same<TypeParam, char>::value) { EXPECT_STREQ(::testing::UnitTest::GetInstance() ->current_test_info() ->test_case_name(), "TypedTestWithNames/char0"); } - if (testing::internal::IsSame<TypeParam, int>::value) { + if (std::is_same<TypeParam, int>::value) { EXPECT_STREQ(::testing::UnitTest::GetInstance() ->current_test_info() ->test_case_name(), @@ -311,13 +312,13 @@ class TypeParametrizedTestWithNames : public Test {}; TYPED_TEST_SUITE_P(TypeParametrizedTestWithNames); TYPED_TEST_P(TypeParametrizedTestWithNames, TestSuiteName) { - if (testing::internal::IsSame<TypeParam, char>::value) { + if (std::is_same<TypeParam, char>::value) { EXPECT_STREQ(::testing::UnitTest::GetInstance() ->current_test_info() ->test_case_name(), "CustomName/TypeParametrizedTestWithNames/parChar0"); } - if (testing::internal::IsSame<TypeParam, int>::value) { + if (std::is_same<TypeParam, int>::value) { EXPECT_STREQ(::testing::UnitTest::GetInstance() ->current_test_info() ->test_case_name(), @@ -331,10 +332,10 @@ class TypeParametrizedTestNames { public: template <typename T> static std::string GetName(int i) { - if (testing::internal::IsSame<T, char>::value) { + if (std::is_same<T, char>::value) { return std::string("parChar") + ::testing::PrintToString(i); } - if (testing::internal::IsSame<T, int>::value) { + if (std::is_same<T, int>::value) { return std::string("parInt") + ::testing::PrintToString(i); } } diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 2b00b70..5020d73 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -61,9 +61,10 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { #include <time.h> #include <map> -#include <vector> #include <ostream> +#include <type_traits> #include <unordered_set> +#include <vector> #include "gtest/gtest-spi.h" #include "src/gtest-internal-inl.h" @@ -226,7 +227,6 @@ using testing::TestProperty; using testing::TestResult; using testing::TimeInMillis; using testing::UnitTest; -using testing::internal::AddReference; using testing::internal::AlwaysFalse; using testing::internal::AlwaysTrue; using testing::internal::AppendUserMessage; @@ -262,7 +262,6 @@ using testing::internal::OsStackTraceGetterInterface; using testing::internal::ParseInt32Flag; using testing::internal::RelationToSourceCopy; using testing::internal::RelationToSourceReference; -using testing::internal::RemoveConst; using testing::internal::RemoveReference; using testing::internal::ShouldRunTestOnShard; using testing::internal::ShouldShard; @@ -7135,33 +7134,6 @@ TEST(RemoveReferenceTest, MacroVersion) { TestGTestRemoveReference<const char, const char&>(); } - -// Tests that RemoveConst does not affect non-const types. -TEST(RemoveConstTest, DoesNotAffectNonConstType) { - CompileAssertTypesEqual<int, RemoveConst<int>::type>(); - CompileAssertTypesEqual<char&, RemoveConst<char&>::type>(); -} - -// Tests that RemoveConst removes const from const types. -TEST(RemoveConstTest, RemovesConst) { - CompileAssertTypesEqual<int, RemoveConst<const int>::type>(); - CompileAssertTypesEqual<char[2], RemoveConst<const char[2]>::type>(); - CompileAssertTypesEqual<char[2][3], RemoveConst<const char[2][3]>::type>(); -} - -// Tests GTEST_REMOVE_CONST_. - -template <typename T1, typename T2> -void TestGTestRemoveConst() { - CompileAssertTypesEqual<T1, GTEST_REMOVE_CONST_(T2)>(); -} - -TEST(RemoveConstTest, MacroVersion) { - TestGTestRemoveConst<int, int>(); - TestGTestRemoveConst<double&, double&>(); - TestGTestRemoveConst<char, const char>(); -} - // Tests GTEST_REMOVE_REFERENCE_AND_CONST_. template <typename T1, typename T2> @@ -7177,30 +7149,6 @@ TEST(RemoveReferenceToConstTest, Works) { TestGTestRemoveReferenceAndConst<const char*, const char*>(); } -// Tests that AddReference does not affect reference types. -TEST(AddReferenceTest, DoesNotAffectReferenceType) { - CompileAssertTypesEqual<int&, AddReference<int&>::type>(); - CompileAssertTypesEqual<const char&, AddReference<const char&>::type>(); -} - -// Tests that AddReference adds reference to non-reference types. -TEST(AddReferenceTest, AddsReference) { - CompileAssertTypesEqual<int&, AddReference<int>::type>(); - CompileAssertTypesEqual<const char&, AddReference<const char>::type>(); -} - -// Tests GTEST_ADD_REFERENCE_. - -template <typename T1, typename T2> -void TestGTestAddReference() { - CompileAssertTypesEqual<T1, GTEST_ADD_REFERENCE_(T2)>(); -} - -TEST(AddReferenceTest, MacroVersion) { - TestGTestAddReference<int&, int>(); - TestGTestAddReference<const char&, const char&>(); -} - // Tests GTEST_REFERENCE_TO_CONST_. template <typename T1, typename T2> |