diff tests/libclient/js-animation/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 96ba0c5cf893
line wrap: on
line diff
--- a/tests/libclient/js-animation/main.cpp	Tue Nov 29 22:25:17 2016 +0100
+++ b/tests/libclient/js-animation/main.cpp	Wed Nov 30 21:15:53 2016 +0100
@@ -19,7 +19,8 @@
 #include <chrono>
 #include <thread>
 
-#include <gtest/gtest.h>
+#define BOOST_TEST_MODULE "Javascript Animation"
+#include <boost/test/unit_test.hpp>
 
 #include <malikania/js_client_resources_loader.hpp>
 #include <malikania/js_animation.hpp>
@@ -29,14 +30,14 @@
 
 using namespace std::chrono_literals;
 
-class TestAnimation : public testing::Test {
+class test_animation {
 protected:
     mlk::directory_resources_locator m_locator;
     mlk::client_resources_loader m_loader;
     UniqueContext m_ctx;
 
 public:
-    TestAnimation()
+    test_animation()
         : m_locator(SOURCE_DIRECTORY "/resources")
         , m_loader(m_locator)
     {
@@ -49,7 +50,9 @@
     }
 };
 
-TEST_F(TestAnimation, basic)
+BOOST_FIXTURE_TEST_SUITE(test_animation_suite, test_animation)
+
+BOOST_AUTO_TEST_CASE(basic)
 {
     try {
         auto ret = duk_peval_string(m_ctx,
@@ -58,8 +61,9 @@
             "d = new Malikania.Animator(a);"
         );
 
-        if (ret != 0)
+        if (ret != 0) {
             throw dukx_exception(m_ctx, -1);
+        }
 
         boost::timer::cpu_timer timer;
 
@@ -72,19 +76,15 @@
                 "w.present();"
             );
 
-            if (ret != 0)
+            if (ret != 0) {
                 throw dukx_exception(m_ctx, -1);
+            }
         }
 
         std::this_thread::sleep_for(3s);
     } catch (const std::exception &ex) {
-        FAIL() << ex.what();
+        BOOST_FAIL(ex.what());
     }
 }
 
-int main(int argc, char **argv)
-{
-    testing::InitGoogleTest(&argc, argv);
-
-    return RUN_ALL_TESTS();
-}
+BOOST_AUTO_TEST_SUITE_END()