From 703a04dc1c45affc6100710c4c36f2623968a2fa Mon Sep 17 00:00:00 2001 From: Ciaran McCreesh Date: Sun, 20 Mar 2011 00:03:46 +0000 Subject: gtest more --- paludis/util/action_queue_TEST.cc | 46 ++++++++++++++++----------------------- 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 #include -#include -#include + #include -using namespace test; +#include + using namespace paludis; namespace @@ -34,30 +34,22 @@ namespace } } -namespace test_cases +TEST(ActionQueue, Works) { - struct ActionQueueTest : TestCase + std::list l; + { + ActionQueue q; + for (int x(0) ; x < 100 ; ++x) + q.enqueue(std::bind(&push_back_to_list, &l, x)); + } + + std::list::const_iterator i(l.begin()); + for (int x(0) ; x < 100 ; ++x) { - ActionQueueTest() : TestCase("action queue") { } - - void run() - { - std::list l; - { - ActionQueue q; - for (int x(0) ; x < 100 ; ++x) - q.enqueue(std::bind(&push_back_to_list, &l, x)); - } - - std::list::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') -- cgit v1.2.3