mirror of
https://github.com/Icinga/icinga2.git
synced 2025-08-20 09:08:16 +02:00
35 lines
587 B
C++
35 lines
587 B
C++
/* Icinga 2 | (c) 2025 Icinga GmbH | GPLv2+ */
|
|
|
|
#include "base/atomic.hpp"
|
|
#include <BoostTestTargetConfig.h>
|
|
|
|
using namespace icinga;
|
|
|
|
BOOST_AUTO_TEST_SUITE(base_atomic)
|
|
|
|
BOOST_AUTO_TEST_CASE(duration_none)
|
|
{
|
|
BOOST_CHECK_EQUAL((double)AtomicDuration(), 0);
|
|
}
|
|
|
|
BOOST_AUTO_TEST_CASE(duration_one)
|
|
{
|
|
AtomicDuration sum;
|
|
|
|
sum += std::chrono::seconds(1);
|
|
|
|
BOOST_CHECK_EQUAL((double)sum, 1);
|
|
}
|
|
|
|
BOOST_AUTO_TEST_CASE(duration_two)
|
|
{
|
|
AtomicDuration sum;
|
|
|
|
sum += std::chrono::seconds(1);
|
|
sum += std::chrono::seconds(2);
|
|
|
|
BOOST_CHECK_EQUAL((double)sum, 3);
|
|
}
|
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|