File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ FASTTYPEGEN_TARGET(simple_types7 simple7.xml)
1919FASTTYPEGEN_TARGET (simple_types8 simple8.xml )
2020FASTTYPEGEN_TARGET (simple_types9 simple9.xml )
2121FASTTYPEGEN_TARGET (simple_types10 simple10.xml )
22+ FASTTYPEGEN_TARGET (simple_types11 simple11.xml )
2223
2324
2425FASTTYPEGEN_TARGET (test_types1 test1.xml test2.xml )
@@ -35,6 +36,7 @@ add_executable (mfast_test
3536 fast_ostream_test.cpp
3637 decoder_operator_test.cpp
3738 encoder_operator_test.cpp
39+ encoder_test.cpp
3840 field_comparator_test.cpp
3941 coder_test.cpp
4042 value_storage_test.cpp
@@ -53,6 +55,7 @@ add_executable (mfast_test
5355 ${FASTTYPEGEN_simple_types8_OUTPUTS}
5456 ${FASTTYPEGEN_simple_types9_OUTPUTS}
5557 ${FASTTYPEGEN_simple_types10_OUTPUTS}
58+ ${FASTTYPEGEN_simple_types11_OUTPUTS}
5659 fast_type_gen_test.cpp
5760 dictionary_builder_test.cpp
5861 json_test.cpp
Original file line number Diff line number Diff line change 1+ #include " catch.hpp"
2+ #include < mfast.h>
3+ #include < mfast/coder/fast_encoder.h>
4+ #include < cstring>
5+ #include < stdexcept>
6+
7+ #include " simple11.h"
8+ #include " byte_stream.h"
9+
10+ TEST_CASE (" test simple encoder" ," [test_encoder]" )
11+ {
12+ mfast::fast_encoder encoder_;
13+ encoder_.include ({simple11::description ()});
14+
15+ const int buffer_size = 128 ;
16+ char buffer[buffer_size];
17+
18+ simple11::Test_1 msg;
19+ simple11::Test_1_mref msg_ref = msg.mref ();
20+
21+ msg_ref.set_field1 ().as (1 );
22+ msg_ref.set_field2 ().as (2 );
23+ msg_ref.set_field3 ().as (3 );
24+
25+ std::size_t encoded_size = encoder_.encode (msg_ref, buffer, buffer_size);
26+
27+ byte_stream result (" \xF8\x81\x81\x82\x83 " );
28+ CHECK (result == byte_stream (buffer, encoded_size));
29+ }
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <templates xmlns =" http://www.fixprotocol.org/ns/template-definition"
3+ templateNs =" http://www.fixprotocol.org/ns/templates/sample"
4+ ns =" http://www.fixprotocol.org/ns/fix" >
5+ <template name =" Test_1" id =" 1" >
6+ <uInt32 name =" field1" id =" 11" ><copy /></uInt32 >
7+ <uInt32 name =" field2" id =" 12" ><copy /></uInt32 >
8+ <uInt32 name =" field3" id =" 13" ><copy /></uInt32 >
9+ </template >
10+ <template name =" Test_2" id =" 2" >
11+ <uInt32 name =" field4" id =" 21" ><copy /></uInt32 >
12+ <uInt32 name =" field5" id =" 22" ><copy /></uInt32 >
13+ <uInt32 name =" field6" id =" 23" ><copy /></uInt32 >
14+ </template >
15+ </templates >
You can’t perform that action at this time.
0 commit comments