From 896fadaaf9f897a570cee21e40144af87e35857e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 21 Dec 2025 15:23:52 +0100 Subject: update FIX tests. Signed-off-by: Amlal El Mahrouss --- test/fix_basic/CMakeLists.txt | 2 +- test/fix_basic/fix.test.cpp | 44 +++++++++++++++++++++++++++++++++++++++++++ test/fix_basic/fix_test.cc | 44 ------------------------------------------- 3 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 test/fix_basic/fix.test.cpp delete mode 100644 test/fix_basic/fix_test.cc (limited to 'test/fix_basic') diff --git a/test/fix_basic/CMakeLists.txt b/test/fix_basic/CMakeLists.txt index b94e3b5..41ba095 100644 --- a/test/fix_basic/CMakeLists.txt +++ b/test/fix_basic/CMakeLists.txt @@ -13,7 +13,7 @@ FetchContent_MakeAvailable(googletest) enable_testing() -add_executable(FIXTestBasic fix_test.cc) +add_executable(FIXTestBasic fix.test.cpp) target_link_libraries(FIXTestBasic gtest_main) set_property(TARGET FIXTestBasic PROPERTY CXX_STANDARD 20) diff --git a/test/fix_basic/fix.test.cpp b/test/fix_basic/fix.test.cpp new file mode 100644 index 0000000..fd82965 --- /dev/null +++ b/test/fix_basic/fix.test.cpp @@ -0,0 +1,44 @@ +/* + * File: tests/fix_test.cc + * Purpose: Custom FIX protocol tests. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License. + */ + +#include +#include + +/// \brief The template to do our tests on. +constexpr char default_fix[] = { + '8', '=', 'F', 'I', 'X', '.', '4', '.', '2', 0x01, + '9', '=', '6', '3', 0x01, // BodyLength = 63 + '3', '5', '=', 'A', 0x01, + '4', '9', '=', 'S', 'E', 'R', 'V', 'E', 'R', 0x01, + '5', '6', '=', 'C', 'L', 'I', 'E', 'N', 'T', 0x01, + '3', '4', '=', '1', '7', '7', 0x01, + '5', '2', '=', '2', '0', '0', '9', '0', '1', '0', '7', '-', '1', '8', ':', '1', '5', ':', '1', '6', 0x01, + '9', '8', '=', '0', 0x01, + '1', '0', '8', '=', '3', '0', 0x01, + '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 +}; + +ocl::fix::visitor basic_visitor; +ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); + +TEST(FIXTest, FIXGoodPacket) +{ + EXPECT_TRUE(fix.is_valid()); +} + +TEST(FIXTest, FIXGoodParse) +{ + EXPECT_TRUE(fix["35"].empty() == false && fix["35"] == "A"); + EXPECT_TRUE(fix["49"].empty() == false && fix["49"] == "SERVER"); + + EXPECT_TRUE(fix["49"].empty() == false && fix["49"] != "A"); +} + +TEST(FIXTest, FIXGoodErrorOnParse) +{ + EXPECT_TRUE(fix["133"].empty() == true && fix["133"] == ""); +} diff --git a/test/fix_basic/fix_test.cc b/test/fix_basic/fix_test.cc deleted file mode 100644 index fd82965..0000000 --- a/test/fix_basic/fix_test.cc +++ /dev/null @@ -1,44 +0,0 @@ -/* - * File: tests/fix_test.cc - * Purpose: Custom FIX protocol tests. - * Author: Amlal El Mahrouss (amlal@nekernel.org) - * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License. - */ - -#include -#include - -/// \brief The template to do our tests on. -constexpr char default_fix[] = { - '8', '=', 'F', 'I', 'X', '.', '4', '.', '2', 0x01, - '9', '=', '6', '3', 0x01, // BodyLength = 63 - '3', '5', '=', 'A', 0x01, - '4', '9', '=', 'S', 'E', 'R', 'V', 'E', 'R', 0x01, - '5', '6', '=', 'C', 'L', 'I', 'E', 'N', 'T', 0x01, - '3', '4', '=', '1', '7', '7', 0x01, - '5', '2', '=', '2', '0', '0', '9', '0', '1', '0', '7', '-', '1', '8', ':', '1', '5', ':', '1', '6', 0x01, - '9', '8', '=', '0', 0x01, - '1', '0', '8', '=', '3', '0', 0x01, - '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 -}; - -ocl::fix::visitor basic_visitor; -ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); - -TEST(FIXTest, FIXGoodPacket) -{ - EXPECT_TRUE(fix.is_valid()); -} - -TEST(FIXTest, FIXGoodParse) -{ - EXPECT_TRUE(fix["35"].empty() == false && fix["35"] == "A"); - EXPECT_TRUE(fix["49"].empty() == false && fix["49"] == "SERVER"); - - EXPECT_TRUE(fix["49"].empty() == false && fix["49"] != "A"); -} - -TEST(FIXTest, FIXGoodErrorOnParse) -{ - EXPECT_TRUE(fix["133"].empty() == true && fix["133"] == ""); -} -- cgit v1.2.3