Fixed unit tests.

This commit is contained in:
Pedro Pinto committed 2018-07-10 16:02:14 +00:00
1 parent 653b1c7814
commit cbe8917f28
1 file changed
+7 -6
@@ -54,15 +54,15 @@ TEST_CASE("JetFIX FIX Encoding","[jetfix_encoding]")
stream.close ();
auto str = stream.to_human_str ();
REQUIRE (str.compare (0,strlen ("8=FIX.4.2|9=000102|"), "8=FIX.4.2|9=000102|")==0);
REQUIRE (str.compare (0,strlen ("8=FIX.4.2|9=000092|"), "8=FIX.4.2|9=000092|")==0);
}
SECTION("checksum_is_correct")
{
char target [] =
"8=FIX.4.2\0019=000102\00135=i\00134=000000000\001369=000000000\001"
"8=FIX.4.2\0019=000092\00135=i\00134=000000000\001369=000000000\001"
"52=20150427-19:05:18.923\00149=O2TESTER\00156=BTS\00157=BTS\001"
"142=US,NC\00158=hello\001";
"58=hello\001";
uint32_t byte_sum = 0;
for (auto c : target)
@@ -74,7 +74,8 @@ TEST_CASE("JetFIX FIX Encoding","[jetfix_encoding]")
stream.close ();
// std::string human_target(target);
// std::replace(human_target.begin(), human_target.end(),'\001','|');
// REQUIRE(stream.to_human_str() == human_target);
// std::cout << human_target << "\n";
// std::cout << stream.to_human_str() << "\n";
auto chk = stream.msg_map ()[0].checksum;
REQUIRE (chk==byte_sum);
}
@@ -88,9 +89,9 @@ TEST_CASE("JetFIX FIX Encoding","[jetfix_encoding]")
stream.stamp (1,1000,"20150427-19:05:18.922");
std::string lit =
"8=FIX.4.2\0019=000102\00135=i\00134=000000002\001369=000001000\001"
"8=FIX.4.2\0019=000092\00135=i\00134=000000002\001369=000001000\001"
"52=20150427-19:05:18.922\00149=O2TESTER\00156=BTS\00157=BTS\001"
"142=US,NC\00158=hello\001";
"58=hello\001";
uint32_t lit_checksum = 0;
for (auto c : lit)
lit_checksum += c;