aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 00:12:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 16:20:41 +0000
commitba4ebf7511fe5e1caa2de070f5c785d59f956e30 (patch)
tree33d3871905208ad1a2f6ba987fb8dded47c5c359
parent40a463a9aaa1ba649e2b13fb60f8cf08ade9838f (diff)
downloadpaludis-ba4ebf7511fe5e1caa2de070f5c785d59f956e30.tar.gz
paludis-ba4ebf7511fe5e1caa2de070f5c785d59f956e30.tar.xz
gtest more
-rw-r--r--paludis/util/buffer_output_stream_TEST.cc64
-rw-r--r--paludis/util/files.m42
2 files changed, 29 insertions, 37 deletions
diff --git a/paludis/util/buffer_output_stream_TEST.cc b/paludis/util/buffer_output_stream_TEST.cc
index 177df56..ae22edd 100644
--- a/paludis/util/buffer_output_stream_TEST.cc
+++ b/paludis/util/buffer_output_stream_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2009, 2010 Ciaran McCreesh
+ * Copyright (c) 2009, 2010, 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
@@ -18,46 +18,38 @@
*/
#include <paludis/util/buffer_output_stream.hh>
-#include <test/test_runner.hh>
-#include <test/test_framework.hh>
+
#include <sstream>
-using namespace test;
+#include <gtest/gtest.h>
+
using namespace paludis;
-namespace test_cases
+TEST(BufferOutputStream, Works)
{
- struct BufferOutputStreamTest : TestCase
+ BufferOutputStream s;
+ EXPECT_TRUE(! s.anything_to_unbuffer());
+
+ std::stringstream t;
+
+ for (int n(0), n_end(1000) ; n != n_end ; ++n)
{
- BufferOutputStreamTest() : TestCase("buffer_output_stream") { }
-
- void run()
- {
- BufferOutputStream s;
- TEST_CHECK(! s.anything_to_unbuffer());
-
- std::stringstream t;
-
- for (int n(0), n_end(1000) ; n != n_end ; ++n)
- {
- s << n << std::endl;
- t << n << std::endl;
- }
-
- std::stringstream ss;
- TEST_CHECK(s.anything_to_unbuffer());
- s.unbuffer(ss);
- TEST_CHECK(! s.anything_to_unbuffer());
-
- TEST_CHECK_EQUAL(ss.str(), t.str());
-
- s << "foo" << std::endl;
- std::stringstream sss;
- TEST_CHECK(s.anything_to_unbuffer());
- s.unbuffer(sss);
- TEST_CHECK(! s.anything_to_unbuffer());
- TEST_CHECK_EQUAL(sss.str(), "foo\n");
- }
- } test_buffer_output_stream;
+ s << n << std::endl;
+ t << n << std::endl;
+ }
+
+ std::stringstream ss;
+ EXPECT_TRUE(s.anything_to_unbuffer());
+ s.unbuffer(ss);
+ EXPECT_TRUE(! s.anything_to_unbuffer());
+
+ EXPECT_EQ(t.str(), ss.str());
+
+ s << "foo" << std::endl;
+ std::stringstream sss;
+ EXPECT_TRUE(s.anything_to_unbuffer());
+ s.unbuffer(sss);
+ EXPECT_TRUE(! s.anything_to_unbuffer());
+ EXPECT_EQ("foo\n", sss.str());
}
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 3d65023..80f12dd 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -12,7 +12,7 @@ add(`accept_visitor', `hh')
add(`action_queue', `hh', `cc', `gtest')
add(`active_object_ptr', `hh', `cc', `fwd', `gtest')
add(`attributes', `hh')
-add(`buffer_output_stream', `hh', `cc', `fwd', `test')
+add(`buffer_output_stream', `hh', `cc', `fwd', `gtest')
add(`byte_swap', `hh', `test')
add(`channel', `hh', `cc')
add(`checked_delete', `hh')