/******************************************************************************
* Icinga 2 *
- * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/) *
+ * Copyright (C) 2012-present Icinga Development Team (http://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 *
#include "base/utility.h"
#include "base/application.h"
#include <boost/test/unit_test.hpp>
-#include <boost/smart_ptr/make_shared.hpp>
#include <boost/foreach.hpp>
-#include <iostream>
using namespace icinga;
BOOST_AUTO_TEST_CASE(construct)
{
- Timer::Ptr timer = boost::make_shared<Timer>();
+ Timer::Ptr timer = make_shared<Timer>();
BOOST_CHECK(timer);
}
BOOST_AUTO_TEST_CASE(interval)
{
- Timer::Ptr timer = boost::make_shared<Timer>();
+ Timer::Ptr timer = make_shared<Timer>();
timer->SetInterval(1.5);
BOOST_CHECK(timer->GetInterval() == 1.5);
}
BOOST_AUTO_TEST_CASE(invoke)
{
int counter;
- Timer::Ptr timer = boost::make_shared<Timer>();
+ Timer::Ptr timer = make_shared<Timer>();
timer->OnTimerExpired.connect(boost::bind(&Callback, &counter));
timer->SetInterval(1);
Utility::Sleep(5.5);
timer->Stop();
- std::cout << counter << std::endl;
BOOST_CHECK(counter >= 4 && counter <= 6);
}
BOOST_AUTO_TEST_CASE(scope)
{
int counter;
- Timer::Ptr timer = boost::make_shared<Timer>();
+ Timer::Ptr timer = make_shared<Timer>();
timer->OnTimerExpired.connect(boost::bind(&Callback, &counter));
timer->SetInterval(1);
timer.reset();
Utility::Sleep(5.5);
- std::cout << counter << std::endl;
BOOST_CHECK(counter >= 4 && counter <= 6);
}