diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 18:24:59 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2011-04-12 18:24:59 +0000 |
commit | fc99b1ad515ccfc92ee92001c409f69385033af5 (patch) | |
tree | c8732acb1a441408870c5e816a3afd01ae1f2e62 /test | |
parent | e9adbcbb56a205dee270842f7d6221c52d508476 (diff) | |
download | googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.tar.gz googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.tar.bz2 googletest-fc99b1ad515ccfc92ee92001c409f69385033af5.zip |
Avoids iterator_traits, as it's not available in libCStd when compiled with Sun C++.
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest-port_test.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc index ff0165fe..1c6e2b09 100644 --- a/test/gtest-port_test.cc +++ b/test/gtest-port_test.cc @@ -39,7 +39,9 @@ # include <time.h> #endif // GTEST_OS_MAC +#include <list> #include <utility> // For std::pair and std::make_pair. +#include <vector> #include "gtest/gtest.h" #include "gtest/gtest-spi.h" @@ -172,6 +174,24 @@ TEST(ImplicitCastTest, CanUseImplicitConstructor) { EXPECT_TRUE(converted); } +TEST(IteratorTraitsTest, WorksForSTLContainerIterators) { + StaticAssertTypeEq<int, + IteratorTraits< ::std::vector<int>::const_iterator>::value_type>(); + StaticAssertTypeEq<bool, + IteratorTraits< ::std::list<bool>::iterator>::value_type>(); +} + +TEST(IteratorTraitsTest, WorksForPointerToNonConst) { + StaticAssertTypeEq<char, IteratorTraits<char*>::value_type>(); + StaticAssertTypeEq<const void*, IteratorTraits<const void**>::value_type>(); +} + +TEST(IteratorTraitsTest, WorksForPointerToConst) { + StaticAssertTypeEq<char, IteratorTraits<const char*>::value_type>(); + StaticAssertTypeEq<const void*, + IteratorTraits<const void* const*>::value_type>(); +} + // Tests that the element_type typedef is available in scoped_ptr and refers // to the parameter type. TEST(ScopedPtrTest, DefinesElementType) { |