]> granicus.if.org Git - icinga2/blobdiff - test/base-timer.cpp
Add --units, --rate and --rate-multiplier support for the snmpv3 check command
[icinga2] / test / base-timer.cpp
index 648459c7a6614ccd67baeebf0885a5ec5f6abb9c..821b29e98dfa4c897aa9aa1d184838b37dfd4416 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  * Icinga 2                                                                   *
- * Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/)   *
+ * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
  *                                                                            *
  * This program is free software; you can redistribute it and/or              *
  * modify it under the terms of the GNU General Public License                *
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
  ******************************************************************************/
 
-#include "base/timer.h"
-#include "base/utility.h"
-#include "base/application.h"
+#include "base/timer.hpp"
+#include "base/utility.hpp"
+#include "base/application.hpp"
 #include <boost/test/unit_test.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
 #include <boost/foreach.hpp>
 
 using namespace icinga;
 
-struct TimerFixture
-{
-       TimerFixture(void)
-       {
-               Timer::Initialize();
-       }
-
-       ~TimerFixture(void)
-       {
-               Timer::Uninitialize();
-       }
-};
-
-BOOST_FIXTURE_TEST_SUITE(base_timer, TimerFixture)
+BOOST_AUTO_TEST_SUITE(base_timer)
 
 BOOST_AUTO_TEST_CASE(construct)
 {
-       Timer::Ptr timer = boost::make_shared<Timer>();
+       Timer::Ptr timer = new Timer();
        BOOST_CHECK(timer);
 }
 
 BOOST_AUTO_TEST_CASE(interval)
 {
-       Timer::Ptr timer = boost::make_shared<Timer>();
+       Timer::Ptr timer = new Timer();
        timer->SetInterval(1.5);
        BOOST_CHECK(timer->GetInterval() == 1.5);
 }
@@ -62,7 +48,7 @@ static void Callback(int *counter)
 BOOST_AUTO_TEST_CASE(invoke)
 {
        int counter;
-       Timer::Ptr timer = boost::make_shared<Timer>();
+       Timer::Ptr timer = new Timer();
        timer->OnTimerExpired.connect(boost::bind(&Callback, &counter));
        timer->SetInterval(1);
 
@@ -77,7 +63,7 @@ BOOST_AUTO_TEST_CASE(invoke)
 BOOST_AUTO_TEST_CASE(scope)
 {
        int counter;
-       Timer::Ptr timer = boost::make_shared<Timer>();
+       Timer::Ptr timer = new Timer();
        timer->OnTimerExpired.connect(boost::bind(&Callback, &counter));
        timer->SetInterval(1);