Skip to content

Commit dd878cc

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 7ddc19c + 94e64e4 commit dd878cc

File tree

4 files changed

+342
-1
lines changed

4 files changed

+342
-1
lines changed

sbe-tool/src/test/cpp/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ set(COMPOSITE_OFFSETS_SCHEMA ${CODEC_SCHEMA_DIR}/composite-offsets-schema.xml)
3838
set(MESSAGE_BLOCK_LENGTH_TEST ${CODEC_SCHEMA_DIR}/message-block-length-test.xml)
3939
set(GROUP_WITH_DATA_SCHEMA ${CODEC_SCHEMA_DIR}/group-with-data-schema.xml)
4040
set(COMPOSITE_ELEMENTS_SCHEMA ${CODEC_SCHEMA_DIR}/composite-elements-schema.xml)
41+
set(ISSUE835_SCHEMA ${CODEC_SCHEMA_DIR}/issue835.xml)
4142

4243
set(GENERATED_CODECS
4344
${CXX_CODEC_TARGET_DIR}
@@ -58,6 +59,7 @@ add_custom_command(
5859
${MESSAGE_BLOCK_LENGTH_TEST}
5960
${GROUP_WITH_DATA_SCHEMA}
6061
${COMPOSITE_ELEMENTS_SCHEMA}
62+
${ISSUE835_SCHEMA}
6163
)
6264

6365
add_custom_target(codecs DEPENDS ${GENERATED_CODECS})
@@ -71,3 +73,4 @@ sbe_test(MessageBlockLengthTest codecs)
7173
sbe_test(GroupWithDataTest codecs)
7274
sbe_test(Rc3OtfFullIrTest codecs)
7375
sbe_test(CompositeElementsTest codecs)
76+
sbe_test(Issue835Test codecs)

sbe-tool/src/test/cpp/GroupWithDataTest.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "group_with_data/TestMessage3.h"
2222
#include "group_with_data/TestMessage4.h"
2323

24-
// using namespace std;
2524
using namespace group::with::data;
2625

2726
static const std::uint32_t TAG_1 = 32;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

Comments
 (0)