aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 19:05:22 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 19:05:22 +0000
commite8c5280f6f0de63a11fb964f4840c204268d5409 (patch)
treef594b5e8e4b8883299a82355b6cf537150958bf8
parentd6aff3b219f7065f4888665b9417dc59377061bb (diff)
downloadpaludis-e8c5280f6f0de63a11fb964f4840c204268d5409.tar.gz
paludis-e8c5280f6f0de63a11fb964f4840c204268d5409.tar.xz
gtest more
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/member_iterator_TEST.cc78
2 files changed, 36 insertions, 44 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 07e5976..148c571 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -52,7 +52,7 @@ add(`make_named_values', `hh', `cc')
add(`make_null_shared_ptr', `hh')
add(`make_shared_copy', `hh', `fwd')
add(`map', `hh', `fwd', `impl', `cc')
-add(`member_iterator', `hh', `fwd', `impl', `test')
+add(`member_iterator', `hh', `fwd', `impl', `gtest')
add(`md5', `hh', `cc', `gtest')
add(`mutex', `hh', `cc', `fwd', `gtest')
add(`named_value', `hh', `cc', `fwd')
diff --git a/paludis/util/member_iterator_TEST.cc b/paludis/util/member_iterator_TEST.cc
index 30579ee..6e06c7c 100644
--- a/paludis/util/member_iterator_TEST.cc
+++ b/paludis/util/member_iterator_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006, 2007 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 2007, 2011 Ciaran McCreesh
* Copyright (c) 2007 David Leverton
*
* This file is part of the Paludis package manager. Paludis is free software;
@@ -20,58 +20,50 @@
#include <paludis/util/member_iterator-impl.hh>
#include <paludis/util/join.hh>
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
+
#include <map>
-using namespace test;
+#include <gtest/gtest.h>
+
using namespace paludis;
-namespace test_cases
+TEST(SecondIterator, Works)
{
- struct SecondIteratorTest : TestCase
- {
- SecondIteratorTest() : TestCase("second_iterator") {}
-
- void run()
- {
- typedef std::map<std::string, std::string> M;
+ typedef std::map<std::string, std::string> M;
- M m;
- m["I"] = "one";
- m["II"] = "two";
- m["III"] = "three";
- m["IV"] = "four";
- m["V"] = "five";
+ M m;
+ m["I"] = "one";
+ m["II"] = "two";
+ m["III"] = "three";
+ m["IV"] = "four";
+ m["V"] = "five";
- SecondIteratorTypes<M::iterator>::Type it = second_iterator(m.begin());
- TEST_CHECK(it == it);
- TEST_CHECK(! (it != it));
- TEST_CHECK_EQUAL(*it, "one");
- TEST_CHECK_EQUAL(it->length(), 3U);
+ SecondIteratorTypes<M::iterator>::Type it = second_iterator(m.begin());
+ ASSERT_TRUE(it == it);
+ ASSERT_TRUE(! (it != it));
+ EXPECT_EQ("one", *it);
+ EXPECT_EQ(3, it->length());
- SecondIteratorTypes<M::iterator>::Type it2(it);
- TEST_CHECK(it == it2);
- TEST_CHECK(! (it != it2));
- TEST_CHECK_EQUAL(*++it2, "two");
- TEST_CHECK_EQUAL(*it2, "two");
- TEST_CHECK_EQUAL(it2->length(), 3U);
- TEST_CHECK(it != it2);
- TEST_CHECK(! (it == it2));
+ SecondIteratorTypes<M::iterator>::Type it2(it);
+ ASSERT_TRUE(it == it2);
+ ASSERT_TRUE(! (it != it2));
+ EXPECT_EQ("two", *++it2);
+ EXPECT_EQ("two", *it2);
+ EXPECT_EQ(3, it2->length());
+ ASSERT_TRUE(it != it2);
+ ASSERT_TRUE(! (it == it2));
- SecondIteratorTypes<M::iterator>::Type it3(it2);
- TEST_CHECK(it2 == it3++);
- TEST_CHECK(it2 != it3);
- TEST_CHECK_EQUAL(*it3, "three");
- TEST_CHECK_EQUAL(it3->length(), 5U);
+ SecondIteratorTypes<M::iterator>::Type it3(it2);
+ ASSERT_TRUE(it2 == it3++);
+ ASSERT_TRUE(it2 != it3);
+ EXPECT_EQ("three", *it3);
+ EXPECT_EQ(5, it3->length());
- it3 = it2;
- TEST_CHECK(it2 == it3);
- TEST_CHECK_EQUAL(*it3, "two");
- TEST_CHECK_EQUAL(*it3++, "two");
+ it3 = it2;
+ ASSERT_TRUE(it2 == it3);
+ EXPECT_EQ("two", *it3);
+ EXPECT_EQ("two", *it3++);
- TEST_CHECK_EQUAL(join(second_iterator(m.begin()), second_iterator(m.end()), " "), "one two three four five");
- }
- } second_iterator_test;
+ EXPECT_EQ("one two three four five", join(second_iterator(m.begin()), second_iterator(m.end()), " "));
}