diff tests/libclient/size/main.cpp @ 44:f30c84b4b9ed

Tests: switch from GoogleTest to Boost.Unit, closes #588
author David Demelier <markand@malikania.fr>
date Wed, 30 Nov 2016 21:15:53 +0100
parents fabbe1759cec
children fe7e3524e571
line wrap: on
line diff
--- a/tests/libclient/size/main.cpp	Tue Nov 29 22:25:17 2016 +0100
+++ b/tests/libclient/size/main.cpp	Wed Nov 30 21:15:53 2016 +0100
@@ -16,57 +16,62 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <gtest/gtest.h>
+#define BOOST_TEST_MODULE "Size"
+#include <boost/test/unit_test.hpp>
 
 #include <malikania/size.hpp>
 
-TEST(Basics, none)
+namespace mlk {
+
+std::ostream& operator<<(std::ostream& out, const size& size)
+{
+    out << "{" << size.width() << ", " << size.height() << "}";
+
+    return out;
+}
+
+}
+
+BOOST_AUTO_TEST_CASE(none)
 {
     mlk::size size;
 
-    ASSERT_EQ(0U, size.width());
-    ASSERT_EQ(0U, size.height());
+    BOOST_REQUIRE_EQUAL(0U, size.width());
+    BOOST_REQUIRE_EQUAL(0U, size.height());
 }
 
-TEST(Basics, null)
+BOOST_AUTO_TEST_CASE(null)
 {
-    ASSERT_TRUE(mlk::size().is_null());
-    ASSERT_FALSE(mlk::size(0, 10).is_null());
-    ASSERT_FALSE(mlk::size(10, 0).is_null());
+    BOOST_REQUIRE(mlk::size().is_null());
+    BOOST_REQUIRE(!mlk::size(0, 10).is_null());
+    BOOST_REQUIRE(!mlk::size(10, 0).is_null());
 }
 
-TEST(Basics, standard)
+BOOST_AUTO_TEST_CASE(standard)
 {
     mlk::size size(10, 20);
 
-    ASSERT_EQ(10U, size.width());
-    ASSERT_EQ(20U, size.height());
+    BOOST_REQUIRE_EQUAL(10U, size.width());
+    BOOST_REQUIRE_EQUAL(20U, size.height());
 }
 
-TEST(Basics, operatorEq)
+BOOST_AUTO_TEST_CASE(operatorEq)
 {
     mlk::size size1, size2;
 
-    ASSERT_EQ(size1, size2);
+    BOOST_REQUIRE_EQUAL(size1, size2);
 }
 
-TEST(Basics, operatorEq1)
+BOOST_AUTO_TEST_CASE(operatorEq1)
 {
     mlk::size size1(10, 20);
     mlk::size size2(10, 20);
 
-    ASSERT_EQ(size1, size2);
+    BOOST_REQUIRE_EQUAL(size1, size2);
 }
 
-TEST(Basics, operatorNeq)
+BOOST_AUTO_TEST_CASE(operatorNeq)
 {
-    ASSERT_NE(mlk::size(10), mlk::size(20));
-    ASSERT_NE(mlk::size(10, 10), mlk::size(10, 20));
+    BOOST_REQUIRE_NE(mlk::size(10), mlk::size(20));
+    BOOST_REQUIRE_NE(mlk::size(10, 10), mlk::size(10, 20));
 }
-
-int main(int argc, char **argv)
-{
-    testing::InitGoogleTest(&argc, argv);
-
-    return RUN_ALL_TESTS();
-}