forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilTests.cpp
More file actions
36 lines (24 loc) · 860 Bytes
/
Copy pathUtilTests.cpp
File metadata and controls
36 lines (24 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "stdafx.h"
#include "Disruptor/Sequence.h"
#include "Disruptor/Util.h"
using namespace Disruptor;
BOOST_AUTO_TEST_SUITE(UtilTests)
BOOST_AUTO_TEST_CASE(ShouldReturnNextPowerOfTwo)
{
auto powerOfTwo = Util::ceilingNextPowerOfTwo(1000);
BOOST_CHECK_EQUAL(1024, powerOfTwo);
}
BOOST_AUTO_TEST_CASE(ShouldReturnExactPowerOfTwo)
{
auto powerOfTwo = Util::ceilingNextPowerOfTwo(1024);
BOOST_CHECK_EQUAL(1024, powerOfTwo);
}
BOOST_AUTO_TEST_CASE(ShouldReturnMinimumSequence)
{
BOOST_CHECK_EQUAL(4L, Util::getMinimumSequence({ std::make_shared< Sequence >(11), std::make_shared< Sequence >(4), std::make_shared< Sequence >(13) }));
}
BOOST_AUTO_TEST_CASE(ShouldReturnLongMaxWhenNoEventProcessors)
{
BOOST_CHECK_EQUAL(std::numeric_limits< std::int64_t >::max(), Util::getMinimumSequence({ }));
}
BOOST_AUTO_TEST_SUITE_END()