summaryrefslogtreecommitdiff
path: root/test/gtest-port_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/gtest-port_test.cc')
-rw-r--r--test/gtest-port_test.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index ff0165f..1c6e2b0 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) {