diff options
author | 2011-03-20 00:03:46 +0000 | |
---|---|---|
committer | 2011-03-20 16:20:41 +0000 | |
commit | 703a04dc1c45affc6100710c4c36f2623968a2fa (patch) | |
tree | 81c2df3689632338d25fa703a5df465c38f26b10 | |
parent | 3d33c91fdd23f937291ec341eff58498ef090ca6 (diff) | |
download | paludis-703a04dc1c45affc6100710c4c36f2623968a2fa.tar.gz paludis-703a04dc1c45affc6100710c4c36f2623968a2fa.tar.xz |
gtest more
-rw-r--r-- | paludis/util/action_queue_TEST.cc | 46 | ||||
-rw-r--r-- | paludis/util/files.m4 | 2 |
2 files changed, 20 insertions, 28 deletions
diff --git a/paludis/util/action_queue_TEST.cc b/paludis/util/action_queue_TEST.cc index eb4cc4ee5..18d61d0d9 100644 --- a/paludis/util/action_queue_TEST.cc +++ b/paludis/util/action_queue_TEST.cc @@ -1,7 +1,7 @@ /* vim: set sw=4 sts=4 et foldmethod=syntax : */ /* - * Copyright (c) 2007, 2008 Ciaran McCreesh + * Copyright (c) 2007, 2008, 2011 Ciaran McCreesh * * This file is part of the Paludis package manager. Paludis is free software; * you can redistribute it and/or modify it under the terms of the GNU General @@ -19,11 +19,11 @@ #include <paludis/util/action_queue.hh> #include <paludis/util/join.hh> -#include <test/test_runner.hh> -#include <test/test_framework.hh> + #include <list> -using namespace test; +#include <gtest/gtest.h> + using namespace paludis; namespace @@ -34,30 +34,22 @@ namespace } } -namespace test_cases +TEST(ActionQueue, Works) { - struct ActionQueueTest : TestCase + std::list<int> l; + { + ActionQueue q; + for (int x(0) ; x < 100 ; ++x) + q.enqueue(std::bind(&push_back_to_list, &l, x)); + } + + std::list<int>::const_iterator i(l.begin()); + for (int x(0) ; x < 100 ; ++x) { - ActionQueueTest() : TestCase("action queue") { } - - void run() - { - std::list<int> l; - { - ActionQueue q; - for (int x(0) ; x < 100 ; ++x) - q.enqueue(std::bind(&push_back_to_list, &l, x)); - } - - std::list<int>::const_iterator i(l.begin()); - for (int x(0) ; x < 100 ; ++x) - { - TEST_CHECK(i != l.end()); - TEST_CHECK(*i == x); - ++i; - } - TEST_CHECK(i == l.end()); - } - } test_action_queue; + ASSERT_TRUE(i != l.end()); + EXPECT_EQ(x, *i); + ++i; + } + EXPECT_TRUE(i == l.end()); } diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 6e8d32b0e..0333b25ad 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -9,7 +9,7 @@ dnl `test', `impl', `testscript'. Note that there isn't much error checking done dnl on this file at present... add(`accept_visitor', `hh') -add(`action_queue', `hh', `cc', `test') +add(`action_queue', `hh', `cc', `gtest') add(`active_object_ptr', `hh', `cc', `fwd', `test') add(`attributes', `hh') add(`buffer_output_stream', `hh', `cc', `fwd', `test') |