aboutsummaryrefslogtreecommitdiff
path: root/paludis/util/stringify_TEST.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/util/stringify_TEST.cc')
-rw-r--r--paludis/util/stringify_TEST.cc129
1 files changed, 38 insertions, 91 deletions
diff --git a/paludis/util/stringify_TEST.cc b/paludis/util/stringify_TEST.cc
index a0e626ff6..f08072cce 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));
}