aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 13:58:49 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-20 16:20:41 +0000
commitfdaa20cdc030d02e0e142c163bf1493af9ca359e (patch)
tree898cabbea5572077654d79a54001db11ca6de0ed
parent98f23a28abc8d6e4c266c0700b432bfc599fc1ef (diff)
downloadpaludis-fdaa20cdc030d02e0e142c163bf1493af9ca359e.tar.gz
paludis-fdaa20cdc030d02e0e142c163bf1493af9ca359e.tar.xz
gtest more
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/stringify_TEST.cc129
2 files changed, 39 insertions, 92 deletions
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index b48f5fd..cf2ab2c 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -78,7 +78,7 @@ add(`sha1', `hh', `cc', `test')
add(`sha256', `hh', `cc', `test')
add(`simple_parser', `hh', `cc', `test', `fwd')
add(`singleton', `hh', `impl', `test')
-add(`stringify', `hh', `test')
+add(`stringify', `hh', `gtest')
add(`string_list_stream', `hh', `cc', `fwd', `gtest')
add(`strip', `hh', `cc', `gtest')
add(`system', `hh', `cc', `gtest')
diff --git a/paludis/util/stringify_TEST.cc b/paludis/util/stringify_TEST.cc
index a0e626f..f08072c 100644
--- a/paludis/util/stringify_TEST.cc
+++ b/paludis/util/stringify_TEST.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh
+ * Copyright (c) 2005, 2006, 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,106 +18,53 @@
*/
#include <paludis/util/stringify.hh>
+
#include <string>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-using namespace test;
-using namespace paludis;
+#include <gtest/gtest.h>
-/** \file
- * Test cases for stringify.hh .
- *
- */
+using namespace paludis;
-namespace test_cases
+TEST(StringifyInt, Works)
{
- /** \test
- * Test stringify on int.
- *
- */
- struct StringifyIntTests : TestCase
- {
- StringifyIntTests() : TestCase("stringify int") { }
-
- void run()
- {
- TEST_CHECK_EQUAL(stringify(0), "0");
- TEST_CHECK_EQUAL(stringify(1), "1");
- TEST_CHECK_EQUAL(stringify(99), "99");
- TEST_CHECK_EQUAL(stringify(-99), "-99");
- TEST_CHECK_EQUAL(stringify(12345), "12345");
- }
- } test_case_stringify_int;
-
- /** \test
- * Test stringify on char *.
- *
- */
- struct StringifyCharStarTests : TestCase
- {
- StringifyCharStarTests() : TestCase("stringify char *") { }
-
- void run()
- {
- TEST_CHECK_EQUAL(stringify("moo"), std::string("moo"));
- TEST_CHECK_EQUAL(stringify(""), std::string(""));
- TEST_CHECK(stringify("").empty());
- TEST_CHECK_EQUAL(stringify(" quack quack "), std::string(" quack quack "));
- }
- } test_case_stringify_char_star;
-
- /** \test
- * Test stringify on std::string.
- *
- */
- struct StringifyStringTests : TestCase
- {
- StringifyStringTests() : TestCase("stringify string") { }
-
- void run()
- {
- TEST_CHECK_EQUAL(stringify(std::string("moo")), std::string("moo"));
- TEST_CHECK_EQUAL(stringify(std::string("")), std::string(""));
- TEST_CHECK(stringify(std::string("")).empty());
- TEST_CHECK_EQUAL(stringify(std::string(" quack quack ")), std::string(" quack quack "));
- }
- } test_case_stringify_string;
+ ASSERT_EQ("0", stringify(0));
+ ASSERT_EQ("1", stringify(1));
+ ASSERT_EQ("99", stringify(99));
+ ASSERT_EQ("-99", stringify(-99));
+ ASSERT_EQ("12345", stringify(12345));
+}
- /** \test
- * Test stringify on char.
- *
- */
- struct StringifyCharTests : TestCase
- {
- StringifyCharTests() : TestCase("stringify char") { }
+TEST(StringifyCharStar, Works)
+{
+ ASSERT_EQ(std::string("moo"), stringify("moo"));
+ ASSERT_EQ(std::string(""), stringify(""));
+ ASSERT_TRUE(stringify("").empty());
+ ASSERT_EQ(std::string(" quack quack "), stringify(" quack quack "));
+}
- void run()
- {
- char c('a');
- TEST_CHECK_EQUAL(stringify(c), std::string("a"));
+TEST(StringifyString, Works)
+{
+ ASSERT_EQ(std::string("moo"), stringify(std::string("moo")));
+ ASSERT_EQ(std::string(""), stringify(std::string("")));
+ ASSERT_TRUE(stringify(std::string("")).empty());
+ ASSERT_EQ(std::string(" quack quack "), stringify(std::string(" quack quack ")));
+}
- unsigned char u('a');
- TEST_CHECK_EQUAL(stringify(u), std::string("a"));
+TEST(StringifyChar, Works)
+{
+ char c('a');
+ ASSERT_EQ(std::string("a"), stringify(c));
- signed char s('a');
- TEST_CHECK_EQUAL(stringify(s), std::string("a"));
- }
- } test_case_stringify_char;
+ unsigned char u('a');
+ ASSERT_EQ(std::string("a"), stringify(u));
- /** \test
- * Test stringify on bool.
- *
- */
- struct StringifyBoolTests : TestCase
- {
- StringifyBoolTests() : TestCase("stringify bool") { }
+ signed char s('a');
+ ASSERT_EQ(std::string("a"), stringify(s));
+}
- void run()
- {
- TEST_CHECK_EQUAL(stringify(true), std::string("true"));
- TEST_CHECK_EQUAL(stringify(false), std::string("false"));
- }
- } test_case_stringify_bool;
+TEST(StringifyBool, Works)
+{
+ ASSERT_EQ(std::string("true"), stringify(true));
+ ASSERT_EQ(std::string("false"), stringify(false));
}