"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googlemock/test/gmock-internal-utils_test.cc" between
googletest-release-1.10.0.tar.gz and googletest-release-1.11.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

gmock-internal-utils_test.cc  (googletest-release-1.10.0):gmock-internal-utils_test.cc  (googletest-release-1.11.0)
skipping to change at line 38 skipping to change at line 38
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Google Mock - a framework for writing C++ mock classes. // Google Mock - a framework for writing C++ mock classes.
// //
// This file tests the internal utilities. // This file tests the internal utilities.
#include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-internal-utils.h"
#include <stdlib.h> #include <stdlib.h>
#include <cstdint>
#include <map> #include <map>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <type_traits>
#include <vector> #include <vector>
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-port.h"
#include "gtest/gtest-spi.h" #include "gtest/gtest-spi.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
// Indicates that this translation unit is part of Google Test's // Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is // implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to // included, or there will be a compiler error. This trick is to
skipping to change at line 126 skipping to change at line 126
EXPECT_EQ("foo bar", ConvertIdentifierNameToWords("_foo_bar_")); EXPECT_EQ("foo bar", ConvertIdentifierNameToWords("_foo_bar_"));
EXPECT_EQ("foo and bar", ConvertIdentifierNameToWords("_foo__and_bar")); EXPECT_EQ("foo and bar", ConvertIdentifierNameToWords("_foo__and_bar"));
} }
TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) { TEST(ConvertIdentifierNameToWordsTest, WorksWhenNameIsMixture) {
EXPECT_EQ("foo bar 123", ConvertIdentifierNameToWords("Foo_bar123")); EXPECT_EQ("foo bar 123", ConvertIdentifierNameToWords("Foo_bar123"));
EXPECT_EQ("chapter 11 section 1", EXPECT_EQ("chapter 11 section 1",
ConvertIdentifierNameToWords("_Chapter11Section_1_")); ConvertIdentifierNameToWords("_Chapter11Section_1_"));
} }
TEST(PointeeOfTest, WorksForSmartPointers) {
EXPECT_TRUE(
(std::is_same<int, PointeeOf<std::unique_ptr<int>>::type>::value));
EXPECT_TRUE(
(std::is_same<std::string,
PointeeOf<std::shared_ptr<std::string>>::type>::value));
}
TEST(PointeeOfTest, WorksForRawPointers) {
EXPECT_TRUE((std::is_same<int, PointeeOf<int*>::type>::value));
EXPECT_TRUE((std::is_same<const char, PointeeOf<const char*>::type>::value));
EXPECT_TRUE((std::is_void<PointeeOf<void*>::type>::value));
}
TEST(GetRawPointerTest, WorksForSmartPointers) { TEST(GetRawPointerTest, WorksForSmartPointers) {
const char* const raw_p1 = new const char('a'); // NOLINT const char* const raw_p1 = new const char('a'); // NOLINT
const std::unique_ptr<const char> p1(raw_p1); const std::unique_ptr<const char> p1(raw_p1);
EXPECT_EQ(raw_p1, GetRawPointer(p1)); EXPECT_EQ(raw_p1, GetRawPointer(p1));
double* const raw_p2 = new double(2.5); // NOLINT double* const raw_p2 = new double(2.5); // NOLINT
const std::shared_ptr<double> p2(raw_p2); const std::shared_ptr<double> p2(raw_p2);
EXPECT_EQ(raw_p2, GetRawPointer(p2)); EXPECT_EQ(raw_p2, GetRawPointer(p2));
} }
TEST(GetRawPointerTest, WorksForRawPointers) { TEST(GetRawPointerTest, WorksForRawPointers) {
skipping to change at line 175 skipping to change at line 161
TEST(KindOfTest, Integer) { TEST(KindOfTest, Integer) {
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(char)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(char)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(signed char)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(signed char)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned char)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned char)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(short)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(short)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned short)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned short)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(int)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(int)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned int)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned int)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(long)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(long)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(long long)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long long)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(wchar_t)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(wchar_t)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(Int64)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(UInt64)); // NOLINT
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(size_t)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(size_t)); // NOLINT
#if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN #if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN
// ssize_t is not defined on Windows and possibly some other OSes. // ssize_t is not defined on Windows and possibly some other OSes.
EXPECT_EQ(kInteger, GMOCK_KIND_OF_(ssize_t)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(ssize_t)); // NOLINT
#endif #endif
} }
TEST(KindOfTest, FloatingPoint) { TEST(KindOfTest, FloatingPoint) {
EXPECT_EQ(kFloatingPoint, GMOCK_KIND_OF_(float)); // NOLINT EXPECT_EQ(kFloatingPoint, GMOCK_KIND_OF_(float)); // NOLINT
EXPECT_EQ(kFloatingPoint, GMOCK_KIND_OF_(double)); // NOLINT EXPECT_EQ(kFloatingPoint, GMOCK_KIND_OF_(double)); // NOLINT
skipping to change at line 225 skipping to change at line 211
TEST(LosslessArithmeticConvertibleTest, IntegerToBool) { TEST(LosslessArithmeticConvertibleTest, IntegerToBool) {
EXPECT_FALSE((LosslessArithmeticConvertible<unsigned char, bool>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<unsigned char, bool>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<int, bool>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int, bool>::value));
} }
TEST(LosslessArithmeticConvertibleTest, IntegerToInteger) { TEST(LosslessArithmeticConvertibleTest, IntegerToInteger) {
// Unsigned => larger signed is fine. // Unsigned => larger signed is fine.
EXPECT_TRUE((LosslessArithmeticConvertible<unsigned char, int>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<unsigned char, int>::value));
// Unsigned => larger unsigned is fine. // Unsigned => larger unsigned is fine.
EXPECT_TRUE( EXPECT_TRUE((LosslessArithmeticConvertible<
(LosslessArithmeticConvertible<unsigned short, UInt64>::value)); // NOLINT unsigned short, uint64_t>::value)); // NOLINT
// Signed => unsigned is not fine. // Signed => unsigned is not fine.
EXPECT_FALSE((LosslessArithmeticConvertible<short, UInt64>::value)); // NOLINT EXPECT_FALSE((LosslessArithmeticConvertible<
short, uint64_t>::value)); // NOLINT
EXPECT_FALSE((LosslessArithmeticConvertible< EXPECT_FALSE((LosslessArithmeticConvertible<
signed char, unsigned int>::value)); // NOLINT signed char, unsigned int>::value)); // NOLINT
// Same size and same signedness: fine too. // Same size and same signedness: fine too.
EXPECT_TRUE((LosslessArithmeticConvertible< EXPECT_TRUE((LosslessArithmeticConvertible<
unsigned char, unsigned char>::value)); unsigned char, unsigned char>::value));
EXPECT_TRUE((LosslessArithmeticConvertible<int, int>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<int, int>::value));
EXPECT_TRUE((LosslessArithmeticConvertible<wchar_t, wchar_t>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<wchar_t, wchar_t>::value));
EXPECT_TRUE((LosslessArithmeticConvertible< EXPECT_TRUE((LosslessArithmeticConvertible<
unsigned long, unsigned long>::value)); // NOLINT unsigned long, unsigned long>::value)); // NOLINT
// Same size, different signedness: not fine. // Same size, different signedness: not fine.
EXPECT_FALSE((LosslessArithmeticConvertible< EXPECT_FALSE((LosslessArithmeticConvertible<
unsigned char, signed char>::value)); unsigned char, signed char>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<int, unsigned int>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int, unsigned int>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<UInt64, Int64>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<uint64_t, int64_t>::value));
// Larger size => smaller size is not fine. // Larger size => smaller size is not fine.
EXPECT_FALSE((LosslessArithmeticConvertible<long, char>::value)); // NOLINT EXPECT_FALSE((LosslessArithmeticConvertible<long, char>::value)); // NOLINT
EXPECT_FALSE((LosslessArithmeticConvertible<int, signed char>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int, signed char>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<Int64, unsigned int>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int64_t, unsigned int>::value));
} }
TEST(LosslessArithmeticConvertibleTest, IntegerToFloatingPoint) { TEST(LosslessArithmeticConvertibleTest, IntegerToFloatingPoint) {
// Integers cannot be losslessly converted to floating-points, as // Integers cannot be losslessly converted to floating-points, as
// the format of the latter is implementation-defined. // the format of the latter is implementation-defined.
EXPECT_FALSE((LosslessArithmeticConvertible<char, float>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<char, float>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<int, double>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int, double>::value));
EXPECT_FALSE((LosslessArithmeticConvertible< EXPECT_FALSE((LosslessArithmeticConvertible<
short, long double>::value)); // NOLINT short, long double>::value)); // NOLINT
} }
TEST(LosslessArithmeticConvertibleTest, FloatingPointToBool) { TEST(LosslessArithmeticConvertibleTest, FloatingPointToBool) {
EXPECT_FALSE((LosslessArithmeticConvertible<float, bool>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<float, bool>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<double, bool>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<double, bool>::value));
} }
TEST(LosslessArithmeticConvertibleTest, FloatingPointToInteger) { TEST(LosslessArithmeticConvertibleTest, FloatingPointToInteger) {
EXPECT_FALSE((LosslessArithmeticConvertible<float, long>::value)); // NOLINT EXPECT_FALSE((LosslessArithmeticConvertible<float, long>::value)); // NOLINT
EXPECT_FALSE((LosslessArithmeticConvertible<double, Int64>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<double, int64_t>::value));
EXPECT_FALSE((LosslessArithmeticConvertible<long double, int>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<long double, int>::value));
} }
TEST(LosslessArithmeticConvertibleTest, FloatingPointToFloatingPoint) { TEST(LosslessArithmeticConvertibleTest, FloatingPointToFloatingPoint) {
// Smaller size => larger size is fine. // Smaller size => larger size is fine.
EXPECT_TRUE((LosslessArithmeticConvertible<float, double>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<float, double>::value));
EXPECT_TRUE((LosslessArithmeticConvertible<float, long double>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<float, long double>::value));
EXPECT_TRUE((LosslessArithmeticConvertible<double, long double>::value)); EXPECT_TRUE((LosslessArithmeticConvertible<double, long double>::value));
// Same size: fine. // Same size: fine.
 End of changes. 10 change blocks. 
23 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)