From de8b6e73fd59763b14d7a2b9fd40f583305133dc Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Wed, 17 Dec 2025 14:52:56 +0100 Subject: chore: updated file structure. Signed-off-by: Amlal El Mahrouss --- example/fix_tag_example/CMakeLists.txt | 15 +++++++++++++ example/fix_tag_example/example.cc | 30 ++++++++++++++++++++++++++ examples/fix_tag_example/CMakeLists.txt | 15 ------------- examples/fix_tag_example/example.cc | 30 -------------------------- test/fix_basic/CMakeLists.txt | 23 ++++++++++++++++++++ test/fix_basic/fix_test.cc | 38 +++++++++++++++++++++++++++++++++ tests/fix_basic/CMakeLists.txt | 23 -------------------- tests/fix_basic/fix_test.cc | 38 --------------------------------- 8 files changed, 106 insertions(+), 106 deletions(-) create mode 100644 example/fix_tag_example/CMakeLists.txt create mode 100644 example/fix_tag_example/example.cc delete mode 100644 examples/fix_tag_example/CMakeLists.txt delete mode 100644 examples/fix_tag_example/example.cc create mode 100644 test/fix_basic/CMakeLists.txt create mode 100644 test/fix_basic/fix_test.cc delete mode 100644 tests/fix_basic/CMakeLists.txt delete mode 100644 tests/fix_basic/fix_test.cc diff --git a/example/fix_tag_example/CMakeLists.txt b/example/fix_tag_example/CMakeLists.txt new file mode 100644 index 0000000..b9a80db --- /dev/null +++ b/example/fix_tag_example/CMakeLists.txt @@ -0,0 +1,15 @@ + +cmake_minimum_required(VERSION 3.15...3.31) + +project( + FixExample + VERSION 1.0 + LANGUAGES CXX) + +find_package(Boost REQUIRED COMPONENTS container) + +add_executable(FixExample example.cc) + +set_property(TARGET FixExample PROPERTY CXX_STANDARD 20) +target_include_directories(FixExample PUBLIC ../../include/ocl) +target_link_libraries(FixExample PRIVATE Boost::container) diff --git a/example/fix_tag_example/example.cc b/example/fix_tag_example/example.cc new file mode 100644 index 0000000..f7f3e76 --- /dev/null +++ b/example/fix_tag_example/example.cc @@ -0,0 +1,30 @@ +#include + +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 +}; + +int main(int argc, char** argv) +{ + ocl::fix::visitor basic_visitor; + ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); + + ocl::io::enable_stdio_sync(false); + + ocl::io::print(":key=35\n"); + ocl::io::print(":value=", fix["35"], "\n"); + + ocl::io::print(":key=49\n"); + ocl::io::print(":value=", fix["49"], "\n"); + + return 0; +} diff --git a/examples/fix_tag_example/CMakeLists.txt b/examples/fix_tag_example/CMakeLists.txt deleted file mode 100644 index b9a80db..0000000 --- a/examples/fix_tag_example/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ - -cmake_minimum_required(VERSION 3.15...3.31) - -project( - FixExample - VERSION 1.0 - LANGUAGES CXX) - -find_package(Boost REQUIRED COMPONENTS container) - -add_executable(FixExample example.cc) - -set_property(TARGET FixExample PROPERTY CXX_STANDARD 20) -target_include_directories(FixExample PUBLIC ../../include/ocl) -target_link_libraries(FixExample PRIVATE Boost::container) diff --git a/examples/fix_tag_example/example.cc b/examples/fix_tag_example/example.cc deleted file mode 100644 index f7f3e76..0000000 --- a/examples/fix_tag_example/example.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include - -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 -}; - -int main(int argc, char** argv) -{ - ocl::fix::visitor basic_visitor; - ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); - - ocl::io::enable_stdio_sync(false); - - ocl::io::print(":key=35\n"); - ocl::io::print(":value=", fix["35"], "\n"); - - ocl::io::print(":key=49\n"); - ocl::io::print(":value=", fix["49"], "\n"); - - return 0; -} diff --git a/test/fix_basic/CMakeLists.txt b/test/fix_basic/CMakeLists.txt new file mode 100644 index 0000000..b94e3b5 --- /dev/null +++ b/test/fix_basic/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.10) +project(FIXTestBasic) + +include(FetchContent) +FetchContent_Declare( + googletest + URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip +) + +# For Windows: Prevent overriding the parent project's compiler/linker settings +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +FetchContent_MakeAvailable(googletest) + +enable_testing() + +add_executable(FIXTestBasic fix_test.cc) +target_link_libraries(FIXTestBasic gtest_main) + +set_property(TARGET FIXTestBasic PROPERTY CXX_STANDARD 20) +target_include_directories(FIXTestBasic PUBLIC ../../include/ocl) + +include(GoogleTest) +gtest_discover_tests(FIXTestBasic) diff --git a/test/fix_basic/fix_test.cc b/test/fix_basic/fix_test.cc new file mode 100644 index 0000000..6139b12 --- /dev/null +++ b/test/fix_basic/fix_test.cc @@ -0,0 +1,38 @@ +/* + * 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 + +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::basic_visitor basic_visitor; +ocl::fix::basic_range_data fix = basic_visitor.visit(default_fix); + +TEST(FIXTest, FIX1) +{ + EXPECT_TRUE(fix.is_valid()); + EXPECT_TRUE(fix["35"].empty() == false && fix["35"] == "A"); + EXPECT_TRUE(fix["49"].empty() == false && fix["49"] == "SERVER"); +} + +TEST(FIXTest, FIX2) +{ + EXPECT_TRUE(fix["133"].empty() == true && fix["133"] != ""); + EXPECT_TRUE(fix["49"].empty() == false && fix["49"] != "A"); +} diff --git a/tests/fix_basic/CMakeLists.txt b/tests/fix_basic/CMakeLists.txt deleted file mode 100644 index b94e3b5..0000000 --- a/tests/fix_basic/CMakeLists.txt +++ /dev/null @@ -1,23 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(FIXTestBasic) - -include(FetchContent) -FetchContent_Declare( - googletest - URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip -) - -# For Windows: Prevent overriding the parent project's compiler/linker settings -set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) -FetchContent_MakeAvailable(googletest) - -enable_testing() - -add_executable(FIXTestBasic fix_test.cc) -target_link_libraries(FIXTestBasic gtest_main) - -set_property(TARGET FIXTestBasic PROPERTY CXX_STANDARD 20) -target_include_directories(FIXTestBasic PUBLIC ../../include/ocl) - -include(GoogleTest) -gtest_discover_tests(FIXTestBasic) diff --git a/tests/fix_basic/fix_test.cc b/tests/fix_basic/fix_test.cc deleted file mode 100644 index 6139b12..0000000 --- a/tests/fix_basic/fix_test.cc +++ /dev/null @@ -1,38 +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 - -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::basic_visitor basic_visitor; -ocl::fix::basic_range_data fix = basic_visitor.visit(default_fix); - -TEST(FIXTest, FIX1) -{ - EXPECT_TRUE(fix.is_valid()); - EXPECT_TRUE(fix["35"].empty() == false && fix["35"] == "A"); - EXPECT_TRUE(fix["49"].empty() == false && fix["49"] == "SERVER"); -} - -TEST(FIXTest, FIX2) -{ - EXPECT_TRUE(fix["133"].empty() == true && fix["133"] != ""); - EXPECT_TRUE(fix["49"].empty() == false && fix["49"] != "A"); -} -- cgit v1.2.3