|
| 1 | +/* |
| 2 | + * Copyright 2013-2021 Real Logic Limited. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +#include "gtest/gtest.h" |
| 18 | +#include "simple/MDUpdateAction.h" |
| 19 | +#include "simple/MDEntryTypeBook.h" |
| 20 | +#include "simple/MDIncrementalRefreshOrderBook47.h" |
| 21 | + |
| 22 | +static const std::size_t BUFFER_LEN = 2048u; |
| 23 | + |
| 24 | +using namespace simple; |
| 25 | + |
| 26 | +class Issue835Test : public testing::Test |
| 27 | +{ |
| 28 | +}; |
| 29 | + |
| 30 | +TEST_F(Issue835Test, shouldCompileWithSkipper) |
| 31 | +{ |
| 32 | + const std::uint64_t timeNs = 777; |
| 33 | + const std::size_t offset = 0; |
| 34 | + char buffer[BUFFER_LEN] = {}; |
| 35 | + MDIncrementalRefreshOrderBook47 encoder = {}; |
| 36 | + |
| 37 | + encoder |
| 38 | + .wrapForEncode(buffer, offset, BUFFER_LEN) |
| 39 | + .transactTime(timeNs) |
| 40 | + .matchEventIndicator() |
| 41 | + .lastQuoteMsg(true) |
| 42 | + .recoveryMsg(false) |
| 43 | + .reserved(true); |
| 44 | + |
| 45 | + MDIncrementalRefreshOrderBook47::NoMDEntries &entries = encoder.noMDEntriesCount(2); |
| 46 | + |
| 47 | + entries.next(); |
| 48 | + entries.orderID(1); |
| 49 | + entries.mDOrderPriority(2); |
| 50 | + entries.mDEntryPx().mantissa(77); |
| 51 | + entries.securityID(33); |
| 52 | + entries.mDUpdateAction(MDUpdateAction::Value::New); |
| 53 | + entries.mDEntryType(MDEntryTypeBook::Value::Bid); |
| 54 | + |
| 55 | + entries.next(); |
| 56 | + entries.orderID(2); |
| 57 | + entries.mDOrderPriority(3); |
| 58 | + entries.mDEntryPx().mantissa(88); |
| 59 | + entries.securityID(44); |
| 60 | + entries.mDUpdateAction(MDUpdateAction::Value::New); |
| 61 | + entries.mDEntryType(MDEntryTypeBook::Value::Offer); |
| 62 | + |
| 63 | + MDIncrementalRefreshOrderBook47 decoder = {}; |
| 64 | + decoder.wrapForDecode( |
| 65 | + buffer, |
| 66 | + offset, |
| 67 | + MDIncrementalRefreshOrderBook47::sbeBlockLength(), |
| 68 | + MDIncrementalRefreshOrderBook47::sbeSchemaVersion(), |
| 69 | + BUFFER_LEN); |
| 70 | + |
| 71 | + EXPECT_EQ(decoder.decodeLength(), encoder.encodedLength()); |
| 72 | +} |
0 commit comments