forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiProducerSequencerTests.cpp
More file actions
29 lines (20 loc) · 930 Bytes
/
Copy pathMultiProducerSequencerTests.cpp
File metadata and controls
29 lines (20 loc) · 930 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
#include "stdafx.h"
#include "Disruptor/BlockingWaitStrategy.h"
#include "Disruptor/MultiProducerSequencer.h"
using namespace Disruptor;
BOOST_AUTO_TEST_SUITE(MultiProducerSequencerTests)
BOOST_AUTO_TEST_CASE(ShouldOnlyAllowMessagesToBeAvailableIfSpecificallyPublished)
{
auto waitingStrategy = std::make_shared< BlockingWaitStrategy >();
auto publisher = std::make_shared< MultiProducerSequencer< int > >(1024, waitingStrategy);
publisher->publish(3);
publisher->publish(5);
BOOST_CHECK_EQUAL(publisher->isAvailable(0), false);
BOOST_CHECK_EQUAL(publisher->isAvailable(1), false);
BOOST_CHECK_EQUAL(publisher->isAvailable(2), false);
BOOST_CHECK_EQUAL(publisher->isAvailable(3), true );
BOOST_CHECK_EQUAL(publisher->isAvailable(4), false);
BOOST_CHECK_EQUAL(publisher->isAvailable(5), true );
BOOST_CHECK_EQUAL(publisher->isAvailable(6), false);
}
BOOST_AUTO_TEST_SUITE_END()