JayBeams  0.1
Another project to have fun coding.
Classes | Functions | Variables
jb::itch5::testing Namespace Reference

Functions used in testing jb::itch5 entities. More...

Classes

struct  mock_book_callback
 
struct  mock_udp_socket
 A Mock Object for the socket class. More...
 

Functions

std::chrono::nanoseconds expected_ts ()
 Return the expected timestamp for all the test messages. More...
 
std::pair< char const *, std::size_t > message_header ()
 
std::pair< char const *, std::size_t > add_order ()
 
std::pair< char const *, std::size_t > add_order_mpid ()
 
std::pair< char const *, std::size_t > broken_trade ()
 
std::pair< char const *, std::size_t > cross_trade ()
 
std::pair< char const *, std::size_t > ipo_quoting_period_update ()
 
std::pair< char const *, std::size_t > market_participant_position ()
 
std::pair< char const *, std::size_t > mwcb_breach ()
 
std::pair< char const *, std::size_t > mwcb_decline_level ()
 
std::pair< char const *, std::size_t > net_order_imbalance_indicator ()
 
std::pair< char const *, std::size_t > order_cancel ()
 
std::pair< char const *, std::size_t > order_delete ()
 
std::pair< char const *, std::size_t > order_executed ()
 
std::pair< char const *, std::size_t > order_executed_price ()
 
std::pair< char const *, std::size_t > order_replace ()
 
std::pair< char const *, std::size_t > reg_sho_restriction ()
 
std::pair< char const *, std::size_t > stock_directory ()
 
std::pair< char const *, std::size_t > stock_trading_action ()
 
std::pair< char const *, std::size_t > system_event ()
 
std::pair< char const *, std::size_t > trade ()
 
std::vector< char > create_message (int message_type, jb::itch5::timestamp ts, std::size_t total_size)
 Generate test messages with a more-or-less valid header. More...
 
stock_directory_message create_stock_directory (char const *symbol)
 Create a dummy jb::itch5::stock_directory_message for testing. More...
 
template<typename side_type >
void test_side_type_trivial (side_type &tested)
 side_type class trivial member tests. More...
 
template<typename side_type >
void test_side_type_errors (side_type &tested)
 Test side type error handling. More...
 
template<typename side_type >
void test_side_type_errors_spec (side_type &tested)
 Test side type error handling. More...
 
template<typename side_type >
void test_side_type_add_reduce (side_type &tested)
 
template<typename order_book >
void test_order_book_type_trivial ()
 order_book type trivial test. More...
 
template<typename order_book >
void test_order_book_type_errors ()
 order_book type error handling test. More...
 
template<typename order_book >
void test_order_book_type_errors_spec ()
 order_book type error handling array_based specific tests. More...
 
template<typename order_book >
void test_order_book_type_add_reduce ()
 order_book type add and reduce handling test. More...
 
template<typename based_order_book >
void test_compute_book_add_order_message_buy ()
 Test compute book based on book type. More...
 
template<typename based_order_book >
void test_compute_book_add_order_message_sell ()
 Test compute book based on book type. More...
 
template<typename based_order_book >
void test_compute_book_increase_coverage ()
 Test compute book increase coverage. More...
 
template<typename based_order_book >
void test_compute_book_edge_cases ()
 Test compute book edge cases. More...
 
template<typename based_order_book >
void test_compute_book_reduction_edge_cases ()
 Test compute book reduction edge cases. More...
 
template<typename based_order_book >
void test_compute_book_replace_edge_cases ()
 Test compute book replace edge cases. More...
 
template<typename based_order_book >
void test_compute_book_order_executed_message ()
 Test compute book order execute message. More...
 
template<typename based_order_book >
void test_compute_book_order_replace_message ()
 Test compute book order replace message. More...
 
template<typename based_order_book >
void test_compute_book_order_cancel_message ()
 Test compute book order cancel message. More...
 
template<typename based_order_book >
void test_compute_book_stock_directory_message ()
 Test compute book stock directory message. More...
 
template<typename based_order_book >
void test_generate_inside_basic (based_order_book &base)
 Test generate_inside. More...
 
template<typename book_type >
void test_order_book_trivial (book_type &tested)
 Test order book trivial members. More...
 
template<typename book_type >
void test_order_book_buy_order_handling (book_type &tested)
 Test order book buy side order handling. More...
 
template<typename book_type >
void test_order_book_sell_order_handling (book_type &tested)
 Test order book sell side order handling. More...
 
template<typename book_type >
void test_order_book_errors (book_type &tested)
 Test order book error conditions. More...
 

Variables

buy_sell_indicator_t const BUY (u 'B')
 
buy_sell_indicator_t const SELL (u 'S')
 

Detailed Description

Functions used in testing jb::itch5 entities.

Function Documentation

◆ add_order()

std::pair< char const *, std::size_t > jb::itch5::testing::add_order ( )

Definition at line 33 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ add_order_mpid()

std::pair< char const *, std::size_t > jb::itch5::testing::add_order_mpid ( )

Definition at line 47 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ broken_trade()

std::pair< char const *, std::size_t > jb::itch5::testing::broken_trade ( )

Definition at line 62 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ create_message()

std::vector< char > jb::itch5::testing::create_message ( int  message_type,
jb::itch5::timestamp  ts,
std::size_t  total_size 
)

Generate test messages with a more-or-less valid header.

For most tests we only need messages with a valid timestamp and message type and a known length. This is a simple function to generate such messages.

Definition at line 287 of file data.cpp.

References jb::itch5::protocol::header_size, jb::itch5::protocol::max_message_size, and jb::itch5::encoder< validate, T >::w().

Referenced by BOOST_AUTO_TEST_CASE(), and test_compute_book_increase_coverage().

◆ create_stock_directory()

stock_directory_message jb::itch5::testing::create_stock_directory ( char const *  symbol)

◆ cross_trade()

std::pair< char const *, std::size_t > jb::itch5::testing::cross_trade ( )

Definition at line 72 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ expected_ts()

std::chrono::nanoseconds jb::itch5::testing::expected_ts ( )

Return the expected timestamp for all the test messages.

Definition at line 19 of file data.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ ipo_quoting_period_update()

std::pair< char const *, std::size_t > jb::itch5::testing::ipo_quoting_period_update ( )

Definition at line 87 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ market_participant_position()

std::pair< char const *, std::size_t > jb::itch5::testing::market_participant_position ( )

Definition at line 100 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ message_header()

std::pair< char const *, std::size_t > jb::itch5::testing::message_header ( )

Definition at line 25 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ mwcb_breach()

std::pair< char const *, std::size_t > jb::itch5::testing::mwcb_breach ( )

Definition at line 113 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ mwcb_decline_level()

std::pair< char const *, std::size_t > jb::itch5::testing::mwcb_decline_level ( )

Definition at line 122 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ net_order_imbalance_indicator()

std::pair< char const *, std::size_t > jb::itch5::testing::net_order_imbalance_indicator ( )

Definition at line 134 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ order_cancel()

std::pair< char const *, std::size_t > jb::itch5::testing::order_cancel ( )

Definition at line 154 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ order_delete()

std::pair< char const *, std::size_t > jb::itch5::testing::order_delete ( )

Definition at line 165 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ order_executed()

std::pair< char const *, std::size_t > jb::itch5::testing::order_executed ( )

Definition at line 175 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ order_executed_price()

std::pair< char const *, std::size_t > jb::itch5::testing::order_executed_price ( )

Definition at line 188 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ order_replace()

std::pair< char const *, std::size_t > jb::itch5::testing::order_replace ( )

Definition at line 203 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ reg_sho_restriction()

std::pair< char const *, std::size_t > jb::itch5::testing::reg_sho_restriction ( )

Definition at line 218 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ stock_directory()

std::pair< char const *, std::size_t > jb::itch5::testing::stock_directory ( )

Definition at line 228 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ stock_trading_action()

std::pair< char const *, std::size_t > jb::itch5::testing::stock_trading_action ( )

Definition at line 250 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

◆ system_event()

std::pair< char const *, std::size_t > jb::itch5::testing::system_event ( )

Definition at line 262 of file data.cpp.

References JB_ITCH5_TEST_HEADER, and jb::testing::defaults::size.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_compute_book_add_order_message_buy()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_add_order_message_buy ( )

Test compute book based on book type.

Template Parameters
based_order_booktype used by compute_order and order_book

Definition at line 30 of file ut_compute_book.cpp.

References BUY, jb::itch5::empty_offer(), and jb::itch5::add_order_message::message_type.

◆ test_compute_book_add_order_message_sell()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_add_order_message_sell ( )

Test compute book based on book type.

Template Parameters
based_order_booktype used by compute_book and order_book

Definition at line 117 of file ut_compute_book.cpp.

References jb::itch5::empty_bid(), jb::itch5::add_order_message::message_type, and SELL.

◆ test_compute_book_edge_cases()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_edge_cases ( )

Test compute book edge cases.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 251 of file ut_compute_book.cpp.

References BUY, and jb::itch5::add_order_message::message_type.

◆ test_compute_book_increase_coverage()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_increase_coverage ( )

Test compute book increase coverage.

Template Parameters
based_order_booktype used by compute book and order book

Definition at line 205 of file ut_compute_book.cpp.

References BUY, create_message(), and jb::itch5::trade_message::message_type.

◆ test_compute_book_order_cancel_message()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_order_cancel_message ( )

◆ test_compute_book_order_executed_message()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_order_executed_message ( )

◆ test_compute_book_order_replace_message()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_order_replace_message ( )

Test compute book order replace message.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 663 of file ut_compute_book.cpp.

References BUY, jb::itch5::empty_offer(), jb::itch5::add_order_mpid_message::message_type, jb::itch5::order_replace_message::message_type, and SELL.

◆ test_compute_book_reduction_edge_cases()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_reduction_edge_cases ( )

Test compute book reduction edge cases.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 308 of file ut_compute_book.cpp.

References BUY, jb::itch5::empty_bid(), jb::itch5::empty_offer(), jb::itch5::order_delete_message::message_type, jb::itch5::order_cancel_message::message_type, jb::itch5::add_order_message::message_type, and SELL.

◆ test_compute_book_replace_edge_cases()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_replace_edge_cases ( )

Test compute book replace edge cases.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 411 of file ut_compute_book.cpp.

References BUY, jb::itch5::order_replace_message::message_type, and jb::itch5::add_order_message::message_type.

◆ test_compute_book_stock_directory_message()

template<typename based_order_book >
void jb::itch5::testing::test_compute_book_stock_directory_message ( )

Test compute book stock directory message.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 903 of file ut_compute_book.cpp.

References create_stock_directory().

◆ test_generate_inside_basic()

template<typename based_order_book >
void jb::itch5::testing::test_generate_inside_basic ( based_order_book &  base)

Test generate_inside.

Template Parameters
based_order_bookType used by compute_book and order_book

Definition at line 30 of file ut_generate_inside.cpp.

References BUY, jb::itch5::generate_inside(), and SELL.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_order_book_buy_order_handling()

template<typename book_type >
void jb::itch5::testing::test_order_book_buy_order_handling ( book_type &  tested)

Test order book buy side order handling.

Definition at line 36 of file ut_order_book.cpp.

References BUY.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_order_book_errors()

template<typename book_type >
void jb::itch5::testing::test_order_book_errors ( book_type &  tested)

Test order book error conditions.

Definition at line 245 of file ut_order_book.cpp.

References BUY, and SELL.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_order_book_sell_order_handling()

template<typename book_type >
void jb::itch5::testing::test_order_book_sell_order_handling ( book_type &  tested)

Test order book sell side order handling.

Definition at line 140 of file ut_order_book.cpp.

References SELL.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_order_book_trivial()

template<typename book_type >
void jb::itch5::testing::test_order_book_trivial ( book_type &  tested)

Test order book trivial members.

Definition at line 13 of file ut_order_book.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ test_order_book_type_add_reduce()

template<typename order_book >
void jb::itch5::testing::test_order_book_type_add_reduce ( )

order_book type add and reduce handling test.

Template Parameters
order_booktype based order book to be tested

Definition at line 293 of file ut_type_based_order_book.hpp.

References test_side_type_add_reduce().

◆ test_order_book_type_errors()

template<typename order_book >
void jb::itch5::testing::test_order_book_type_errors ( )

order_book type error handling test.

Template Parameters
order_booktype based order book to be tested

Definition at line 261 of file ut_type_based_order_book.hpp.

References test_side_type_errors().

◆ test_order_book_type_errors_spec()

template<typename order_book >
void jb::itch5::testing::test_order_book_type_errors_spec ( )

order_book type error handling array_based specific tests.

Template Parameters
order_booktype based order book to be tested

Definition at line 277 of file ut_type_based_order_book.hpp.

References test_side_type_errors_spec().

◆ test_order_book_type_trivial()

template<typename order_book >
void jb::itch5::testing::test_order_book_type_trivial ( )

order_book type trivial test.

Template Parameters
order_booktype based order book to be tested

Definition at line 245 of file ut_type_based_order_book.hpp.

References test_side_type_trivial().

◆ test_side_type_add_reduce()

template<typename side_type >
void jb::itch5::testing::test_side_type_add_reduce ( side_type &  tested)

Definition at line 139 of file ut_type_based_order_book.hpp.

Referenced by test_order_book_type_add_reduce().

◆ test_side_type_errors()

template<typename side_type >
void jb::itch5::testing::test_side_type_errors ( side_type &  tested)

Test side type error handling.

Template Parameters
side_typeSide to be tested

Definition at line 47 of file ut_type_based_order_book.hpp.

Referenced by test_order_book_type_errors().

◆ test_side_type_errors_spec()

template<typename side_type >
void jb::itch5::testing::test_side_type_errors_spec ( side_type &  tested)

Test side type error handling.

Template Parameters
side_typeSide to be tested

Definition at line 112 of file ut_type_based_order_book.hpp.

Referenced by test_order_book_type_errors_spec().

◆ test_side_type_trivial()

template<typename side_type >
void jb::itch5::testing::test_side_type_trivial ( side_type &  tested)

side_type class trivial member tests.

Template Parameters
side_typeSide type to be tested

Uses testing hook is_ascending() to know if tested is buy or sell side

Definition at line 17 of file ut_type_based_order_book.hpp.

Referenced by test_order_book_type_trivial().

◆ trade()

std::pair< char const *, std::size_t > jb::itch5::testing::trade ( )

Definition at line 271 of file data.cpp.

References JB_ITCH5_TEST_HEADER.

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ BUY

buy_sell_indicator_t const jb::itch5::testing::BUY(u 'B')

◆ SELL

buy_sell_indicator_t const jb::itch5::testing::SELL(u 'S')