aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-24 23:12:40 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-03-24 23:12:40 +0000
commit57bbb2a8aca253593c3ed4cdeea25b2c6dab4f20 (patch)
treef7b0ed9d8f224efb696120426a94b4317b2358fe
parent170789a9e18a820fa92e6af4448eca06d631b56f (diff)
downloadpaludis-57bbb2a8aca253593c3ed4cdeea25b2c6dab4f20.tar.gz
paludis-57bbb2a8aca253593c3ed4cdeea25b2c6dab4f20.tar.xz
gtest more
-rw-r--r--paludis/files.m42
-rw-r--r--paludis/version_operator_TEST.cc129
2 files changed, 48 insertions, 83 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index 2789b3c..989ed31 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -104,7 +104,7 @@ add(`unchoices_key', `hh', `cc', `fwd')
add(`unformatted_pretty_printer', `hh', `cc', `fwd')
add(`unmerger', `hh', `cc')
add(`user_dep_spec', `hh', `cc', `se', `fwd', `test')
-add(`version_operator', `hh', `cc', `fwd', `se', `test')
+add(`version_operator', `hh', `cc', `fwd', `se', `gtest')
add(`version_requirements', `hh', `cc', `fwd')
add(`version_spec', `hh', `cc', `se', `fwd', `gtest')
diff --git a/paludis/version_operator_TEST.cc b/paludis/version_operator_TEST.cc
index 6eb4fd8..83f6f22 100644
--- a/paludis/version_operator_TEST.cc
+++ b/paludis/version_operator_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,95 +18,60 @@
*/
#include <paludis/version_operator.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
+#include <paludis/util/stringify.hh>
-using namespace test;
-using namespace paludis;
+#include <gtest/gtest.h>
-/** \file
- * Test cases for version_operator.hh.
- *
- */
+using namespace paludis;
-namespace test_cases
+TEST(VersionOperator, Comparisons)
{
- /**
- * \test Test VersionOperator creation and assignment.
- *
- */
- struct VersionOperatorTest : TestCase
- {
- VersionOperatorTest() : TestCase("version operator") { }
-
- void run()
- {
- VersionOperator v1(vo_greater);
- VersionOperator v2(vo_less_equal);
- TEST_CHECK(v1 != v2);
- TEST_CHECK(v1 == vo_greater);
- TEST_CHECK(v1 != vo_less_equal);
- TEST_CHECK(v2 == vo_less_equal);
- TEST_CHECK(v2 != vo_greater);
-
- VersionOperator v3(v1);
- TEST_CHECK(v1 == vo_greater);
- TEST_CHECK(v3 == vo_greater);
- TEST_CHECK(v1 == v3);
+ VersionOperator v1(vo_greater);
+ VersionOperator v2(vo_less_equal);
+ EXPECT_TRUE(v1 != v2);
+ EXPECT_TRUE(v1 == vo_greater);
+ EXPECT_TRUE(v1 != vo_less_equal);
+ EXPECT_TRUE(v2 == vo_less_equal);
+ EXPECT_TRUE(v2 != vo_greater);
- v3 = v2;
- TEST_CHECK(v1 != v3);
- TEST_CHECK(v1 != v2);
- TEST_CHECK(v2 == v3);
- TEST_CHECK(v1 == vo_greater);
- TEST_CHECK(v2 == vo_less_equal);
- TEST_CHECK(v3 == vo_less_equal);
- }
- } test_version_operator;
+ VersionOperator v3(v1);
+ EXPECT_TRUE(v1 == vo_greater);
+ EXPECT_TRUE(v3 == vo_greater);
+ EXPECT_TRUE(v1 == v3);
- /**
- * \test Test VersionOperator creation and assignment from a string.
- *
- */
- struct VersionOperatorFromStringTest : TestCase
- {
- VersionOperatorFromStringTest() : TestCase("version operator from string") { }
-
- void run()
- {
- VersionOperator v1(">");
- VersionOperator v2("<=");
- TEST_CHECK(v1 != v2);
- TEST_CHECK(v1 == vo_greater);
- TEST_CHECK(v1 != vo_less_equal);
- TEST_CHECK(v2 == vo_less_equal);
- TEST_CHECK(v2 != vo_greater);
+ v3 = v2;
+ EXPECT_TRUE(v1 != v3);
+ EXPECT_TRUE(v1 != v2);
+ EXPECT_TRUE(v2 == v3);
+ EXPECT_TRUE(v1 == vo_greater);
+ EXPECT_TRUE(v2 == vo_less_equal);
+ EXPECT_TRUE(v3 == vo_less_equal);
+}
- TEST_CHECK_EQUAL(VersionOperator("<"), VersionOperator(vo_less));
- TEST_CHECK_EQUAL(VersionOperator("<="), VersionOperator(vo_less_equal));
- TEST_CHECK_EQUAL(VersionOperator("="), VersionOperator(vo_equal));
- TEST_CHECK_EQUAL(VersionOperator("~"), VersionOperator(vo_tilde));
- TEST_CHECK_EQUAL(VersionOperator(">"), VersionOperator(vo_greater));
- TEST_CHECK_EQUAL(VersionOperator(">="), VersionOperator(vo_greater_equal));
- TEST_CHECK_EQUAL(VersionOperator("~>"), VersionOperator(vo_tilde_greater));
- }
- } test_version_operator_from_string;
+TEST(VersionOperator, FromString)
+{
+ VersionOperator v1(">");
+ VersionOperator v2("<=");
+ EXPECT_TRUE(v1 != v2);
+ EXPECT_TRUE(v1 == vo_greater);
+ EXPECT_TRUE(v1 != vo_less_equal);
+ EXPECT_TRUE(v2 == vo_less_equal);
+ EXPECT_TRUE(v2 != vo_greater);
- /**
- * \test Test VersionOperator stringification.
- *
- */
- struct VersionOperatorToStringTest : TestCase
- {
- VersionOperatorToStringTest() : TestCase("version operator to string") { }
+ EXPECT_EQ(VersionOperator("<"), VersionOperator(vo_less));
+ EXPECT_EQ(VersionOperator("<="), VersionOperator(vo_less_equal));
+ EXPECT_EQ(VersionOperator("="), VersionOperator(vo_equal));
+ EXPECT_EQ(VersionOperator("~"), VersionOperator(vo_tilde));
+ EXPECT_EQ(VersionOperator(">"), VersionOperator(vo_greater));
+ EXPECT_EQ(VersionOperator(">="), VersionOperator(vo_greater_equal));
+ EXPECT_EQ(VersionOperator("~>"), VersionOperator(vo_tilde_greater));
+}
- void run()
- {
- TEST_CHECK_EQUAL(stringify(VersionOperator(vo_greater)), ">");
- TEST_CHECK_EQUAL(stringify(VersionOperator(vo_equal)), "=");
- TEST_CHECK_EQUAL(stringify(VersionOperator(vo_tilde)), "~");
- TEST_CHECK_EQUAL(stringify(VersionOperator(vo_tilde_greater)), "~>");
- }
- } test_version_operator_to_string;
+TEST(VersionOperator, Stringify)
+{
+ EXPECT_EQ(">", stringify(VersionOperator(vo_greater)));
+ EXPECT_EQ("=", stringify(VersionOperator(vo_equal)));
+ EXPECT_EQ("~", stringify(VersionOperator(vo_tilde)));
+ EXPECT_EQ("~>", stringify(VersionOperator(vo_tilde_greater)));
}