diff options
-rw-r--r-- | paludis/util/files.m4 | 2 | ||||
-rw-r--r-- | paludis/util/member_iterator_TEST.cc | 78 |
2 files changed, 36 insertions, 44 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 07e5976a1..148c57127 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 30579eef4..6e06c7c96 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()), " ")); } |