diff options
author | 2011-03-20 16:36:56 +0000 | |
---|---|---|
committer | 2011-03-20 16:36:56 +0000 | |
commit | cc291a58865c3d7e6489e39e7ba559a93f5f5428 (patch) | |
tree | 8a0f13bdd836a8134ce06ba6017529689aaf397e | |
parent | fd9ce01d7672f0efdc4f161e16eec5aeaf48abff (diff) | |
download | paludis-cc291a58865c3d7e6489e39e7ba559a93f5f5428.tar.gz paludis-cc291a58865c3d7e6489e39e7ba559a93f5f5428.tar.xz |
gtest more
-rw-r--r-- | paludis/util/files.m4 | 2 | ||||
-rw-r--r-- | paludis/util/pool_TEST.cc | 68 |
2 files changed, 28 insertions, 42 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 2b2a5e955..f14c61de5 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -60,7 +60,7 @@ add(`operators', `hh') add(`options', `hh', `fwd', `cc', `test') add(`pimp', `hh', `impl') add(`pipe', `hh', `cc') -add(`pool', `hh', `cc', `impl', `test') +add(`pool', `hh', `cc', `impl', `gtest') add(`pretty_print', `hh', `cc', `gtest') add(`process', `hh', `cc', `fwd', `gtest', `testscript') add(`pty', `hh', `cc', `gtest') diff --git a/paludis/util/pool_TEST.cc b/paludis/util/pool_TEST.cc index c4b802d68..da37f53f6 100644 --- a/paludis/util/pool_TEST.cc +++ b/paludis/util/pool_TEST.cc @@ -20,11 +20,10 @@ #include <paludis/util/pool-impl.hh> #include <paludis/util/singleton-impl.hh> #include <paludis/util/pimp-impl.hh> -#include <test/test_runner.hh> -#include <test/test_framework.hh> + +#include <gtest/gtest.h> using namespace paludis; -using namespace test; namespace { @@ -51,52 +50,39 @@ namespace }; } -namespace test_cases +TEST(Pool, Monkey) { - struct PoolMonkeyTest : TestCase - { - PoolMonkeyTest() : TestCase("pool monkey test") { } - - void run() - { - auto a(Pool<Monkey>::get_instance()->create(std::string("alexander"))); - auto b(Pool<Monkey>::get_instance()->create(std::string("gunther"))); - auto c(Pool<Monkey>::get_instance()->create(std::string("alexander"))); - - TEST_CHECK(a->name == "alexander"); - TEST_CHECK(b->name == "gunther"); - TEST_CHECK(c->name == "alexander"); + auto a(Pool<Monkey>::get_instance()->create(std::string("alexander"))); + auto b(Pool<Monkey>::get_instance()->create(std::string("gunther"))); + auto c(Pool<Monkey>::get_instance()->create(std::string("alexander"))); - TEST_CHECK(a == c); - } - } test_pool_monkey; + EXPECT_TRUE(a->name == "alexander"); + EXPECT_TRUE(b->name == "gunther"); + EXPECT_TRUE(c->name == "alexander"); - struct PoolWeaselTest : TestCase - { - PoolWeaselTest() : TestCase("pool weasel test") { } + EXPECT_TRUE(a == c); +} - void run() - { - auto a(Pool<Weasel>::get_instance()->create(std::string("william"), 8)); - auto b(Pool<Weasel>::get_instance()->create(std::string("tony"), 5)); - auto c(Pool<Weasel>::get_instance()->create(std::string("william"), 8)); - auto d(Pool<Weasel>::get_instance()->create(std::string("tony"), 10)); +TEST(Pool, Weasel) +{ + auto a(Pool<Weasel>::get_instance()->create(std::string("william"), 8)); + auto b(Pool<Weasel>::get_instance()->create(std::string("tony"), 5)); + auto c(Pool<Weasel>::get_instance()->create(std::string("william"), 8)); + auto d(Pool<Weasel>::get_instance()->create(std::string("tony"), 10)); - TEST_CHECK(a->name == "william"); - TEST_CHECK(a->viciousness == 8); + EXPECT_TRUE(a->name == "william"); + EXPECT_TRUE(a->viciousness == 8); - TEST_CHECK(b->name == "tony"); - TEST_CHECK(b->viciousness == 5); + EXPECT_TRUE(b->name == "tony"); + EXPECT_TRUE(b->viciousness == 5); - TEST_CHECK(c->name == "william"); - TEST_CHECK(c->viciousness == 8); + EXPECT_TRUE(c->name == "william"); + EXPECT_TRUE(c->viciousness == 8); - TEST_CHECK(d->name == "tony"); - TEST_CHECK(d->viciousness == 10); + EXPECT_TRUE(d->name == "tony"); + EXPECT_TRUE(d->viciousness == 10); - TEST_CHECK(a == c); - TEST_CHECK(b != d); - } - } test_pool_weasel; + EXPECT_TRUE(a == c); + EXPECT_TRUE(b != d); } |