aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 13:33:56 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 16:20:41 +0000
commit7fcad905fc123550bf03e02ff069aedabdb6e7b0 (patch)
tree9a854d0ffb96c4a5cfb8247baa23d9a42d297f7d
parent01fd92a6df4b3594db3b8eed683da3a4abbe776a (diff)
downloadpaludis-7fcad905fc123550bf03e02ff069aedabdb6e7b0.tar.gz
paludis-7fcad905fc123550bf03e02ff069aedabdb6e7b0.tar.xz
gtest more
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/strip_TEST.cc113
2 files changed, 36 insertions, 79 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index f08040a..c4b1733 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -80,7 +80,7 @@ add(`simple_parser', `hh', `cc', `test', `fwd')
add(`singleton', `hh', `impl', `test')
add(`stringify', `hh', `test')
add(`string_list_stream', `hh', `cc', `fwd', `test')
-add(`strip', `hh', `cc', `test')
+add(`strip', `hh', `cc', `gtest')
add(`system', `hh', `cc', `gtest')
add(`tail_output_stream', `hh', `cc', `fwd', `gtest')
add(`tee_output_stream', `hh', `cc', `fwd')
diff --git a/paludis/util/strip_TEST.cc b/paludis/util/strip_TEST.cc
index 721703a..0dc05f1 100644
--- a/paludis/util/strip_TEST.cc
+++ b/paludis/util/strip_TEST.cc
@@ -2,6 +2,7 @@
/*
* Copyright (c) 2006 Mark Loeser
+ * Copyright (c) 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,92 +19,48 @@
*/
-#include <algorithm>
#include <paludis/util/strip.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
+
+#include <algorithm>
#include <vector>
-using namespace paludis;
-using namespace test;
+#include <gtest/gtest.h>
-/** \file
- * Test cases for strip.hh.
- *
- */
+using namespace paludis;
-namespace test_cases
+TEST(StripLeadingString, Works)
{
- /**
- * \test Test StripLeadingString.
- *
- */
- struct StripLeadingStringTest : TestCase
- {
- StripLeadingStringTest() : TestCase("StripLeadingString") { }
-
- void run()
- {
- TEST_CHECK("bar" == strip_leading_string("foobar", "foo"));
- TEST_CHECK("fishbar" == strip_leading_string("fishbar", "foo"));
- TEST_CHECK("" == strip_leading_string("foo", "foo"));
- TEST_CHECK("fishfoobar" == strip_leading_string("fishfoobar", "foo"));
- TEST_CHECK("blahfoo" == strip_leading_string("blahfoo", "foo"));
- }
- } test_strip_leading_string;
-
- /**
- * \test Test StripLeading.
- *
- */
- struct StripLeadingTest : TestCase
- {
- StripLeadingTest() : TestCase("StripLeading") {}
-
- void run()
- {
- TEST_CHECK("bar" == strip_leading("foobar", "foo"));
- TEST_CHECK("ishbar" == strip_leading("fishbar", "foo"));
- TEST_CHECK("" == strip_leading("foo", "foo"));
- TEST_CHECK("ishfoobar" == strip_leading("fishfoobar", "foo"));
- TEST_CHECK("blahfoo" == strip_leading("blahfoo", "foo"));
- }
- } test_strip_leading;
-
- /**
- * \test Test StripTrailingString.
- *
- */
- struct StripTrailingStringTest : TestCase
- {
- StripTrailingStringTest() : TestCase("StripTrailingString") { }
+ EXPECT_TRUE("bar" == strip_leading_string("foobar", "foo"));
+ EXPECT_TRUE("fishbar" == strip_leading_string("fishbar", "foo"));
+ EXPECT_TRUE("" == strip_leading_string("foo", "foo"));
+ EXPECT_TRUE("fishfoobar" == strip_leading_string("fishfoobar", "foo"));
+ EXPECT_TRUE("blahfoo" == strip_leading_string("blahfoo", "foo"));
+}
- void run()
- {
- TEST_CHECK("foobar" == strip_trailing_string("foobar", "foo"));
- TEST_CHECK("fishbar" == strip_trailing_string("fishbar", "foo"));
- TEST_CHECK("" == strip_trailing_string("foo", "foo"));
- TEST_CHECK("fishfoobar" == strip_trailing_string("fishfoobar", "foo"));
- TEST_CHECK("blah" == strip_trailing_string("blahfoo", "foo"));
- }
- } test_strip_trailing_string;
+TEST(StripLeading, Works)
+{
+ EXPECT_TRUE("bar" == strip_leading("foobar", "foo"));
+ EXPECT_TRUE("ishbar" == strip_leading("fishbar", "foo"));
+ EXPECT_TRUE("" == strip_leading("foo", "foo"));
+ EXPECT_TRUE("ishfoobar" == strip_leading("fishfoobar", "foo"));
+ EXPECT_TRUE("blahfoo" == strip_leading("blahfoo", "foo"));
+}
- /**
- * \test Test StripTrailing.
- *
- */
- struct StripTrailingTest : TestCase
- {
- StripTrailingTest() : TestCase("StripTrailing") {}
+TEST(StripTrailingString, Works)
+{
+ EXPECT_TRUE("foobar" == strip_trailing_string("foobar", "foo"));
+ EXPECT_TRUE("fishbar" == strip_trailing_string("fishbar", "foo"));
+ EXPECT_TRUE("" == strip_trailing_string("foo", "foo"));
+ EXPECT_TRUE("fishfoobar" == strip_trailing_string("fishfoobar", "foo"));
+ EXPECT_TRUE("blah" == strip_trailing_string("blahfoo", "foo"));
+}
- void run()
- {
- TEST_CHECK("foobar" == strip_trailing("foobar", "foo"));
- TEST_CHECK("fishbar" == strip_trailing("fishbar", "foo"));
- TEST_CHECK("" == strip_trailing("foo", "foo"));
- TEST_CHECK("fishfoobar" == strip_trailing("fishfoobar", "foo"));
- TEST_CHECK("blah" == strip_trailing("blahfoo", "foo"));
- }
- } test_strip_trailing;
+TEST(StripTrailing, Works)
+{
+ EXPECT_TRUE("foobar" == strip_trailing("foobar", "foo"));
+ EXPECT_TRUE("fishbar" == strip_trailing("fishbar", "foo"));
+ EXPECT_TRUE("" == strip_trailing("foo", "foo"));
+ EXPECT_TRUE("fishfoobar" == strip_trailing("fishfoobar", "foo"));
+ EXPECT_TRUE("blah" == strip_trailing("blahfoo", "foo"));
}