|
Database System 0.1.0
Advanced C++20 Database System with Multi-Backend Support
|
Phase 6: Unit tests for unified_database_system. More...
#include "integrated/unified_database_system.h"#include "core/database_backend.h"#include "core/backend_registry.h"#include <iostream>#include <cassert>#include <chrono>#include <thread>
Go to the source code of this file.
Macros | |
| #define | TEST_START(name) |
| #define | ASSERT_TRUE(condition, message) |
| #define | ASSERT_FALSE(condition, message) |
| #define | TEST_END() |
Variables | |
| static int | tests_passed = 0 |
| static int | tests_failed = 0 |
Phase 6: Unit tests for unified_database_system.
Tests the main entry point of the integrated database system. These tests focus on API availability, configuration, and initialization. Integration tests with real databases are in integration_tests/.
Definition in file test_unified_database_system.cpp.
| #define ASSERT_FALSE | ( | condition, | |
| message ) |
Definition at line 43 of file test_unified_database_system.cpp.
Referenced by test_config_construction(), test_connect_mock_backend(), test_connect_unsupported_backend(), test_connection_state_api(), test_health_check_api(), test_health_check_structure(), test_query_param_null_safety(), test_query_parameters(), test_query_result_structure(), test_select_success(), test_transaction_commit(), test_transaction_is_active(), test_transaction_rollback(), and test_zero_config_construction().
| #define ASSERT_TRUE | ( | condition, | |
| message ) |
Definition at line 33 of file test_unified_database_system.cpp.
Referenced by test_begin_transaction_failure(), test_begin_transaction_success(), test_builder_custom(), test_builder_default(), test_connect_mock_backend(), test_connect_typed_backend(), test_connect_unsupported_backend(), test_create_query_builder(), test_error_handling_no_connection(), test_execute_success(), test_execute_transaction_failure(), test_execute_transaction_success(), test_get_backend_type(), test_get_config(), test_get_pool_stats(), test_health_check_api(), test_health_check_structure(), test_insert_failure_not_connected(), test_insert_success(), test_metrics_api(), test_metrics_structure(), test_metrics_update_on_query(), test_move_semantics(), test_query_param_null_safety(), test_query_parameters(), test_query_result_structure(), test_remove_failure_not_connected(), test_remove_success(), test_reset_metrics(), test_select_failure_not_connected(), test_select_success(), test_thread_safety_health_checks(), test_thread_safety_metrics(), test_transaction_commit(), test_transaction_execute(), test_transaction_is_active(), test_transaction_metrics(), test_transaction_raii_cleanup(), test_transaction_rollback(), test_update_failure_not_connected(), and test_update_success().
| #define TEST_END | ( | ) |
Definition at line 46 of file test_unified_database_system.cpp.
Referenced by test_begin_transaction_failure(), test_begin_transaction_success(), test_builder_custom(), test_builder_default(), test_config_construction(), test_connect_mock_backend(), test_connect_typed_backend(), test_connect_unsupported_backend(), test_connection_state_api(), test_create_query_builder(), test_error_handling_no_connection(), test_execute_success(), test_execute_transaction_failure(), test_execute_transaction_success(), test_get_backend_type(), test_get_config(), test_get_pool_stats(), test_health_check_api(), test_health_check_structure(), test_insert_failure_not_connected(), test_insert_success(), test_metrics_api(), test_metrics_structure(), test_metrics_update_on_query(), test_move_semantics(), test_query_param_null_safety(), test_query_parameters(), test_query_result_structure(), test_remove_failure_not_connected(), test_remove_success(), test_reset_metrics(), test_select_failure_not_connected(), test_select_success(), test_thread_safety_health_checks(), test_thread_safety_metrics(), test_transaction_commit(), test_transaction_execute(), test_transaction_is_active(), test_transaction_metrics(), test_transaction_raii_cleanup(), test_transaction_rollback(), test_update_failure_not_connected(), test_update_success(), and test_zero_config_construction().
| #define TEST_START | ( | name | ) |
Definition at line 30 of file test_unified_database_system.cpp.
Referenced by test_begin_transaction_failure(), test_begin_transaction_success(), test_builder_custom(), test_builder_default(), test_config_construction(), test_connect_mock_backend(), test_connect_typed_backend(), test_connect_unsupported_backend(), test_connection_state_api(), test_create_query_builder(), test_error_handling_no_connection(), test_execute_success(), test_execute_transaction_failure(), test_execute_transaction_success(), test_get_backend_type(), test_get_config(), test_get_pool_stats(), test_health_check_api(), test_health_check_structure(), test_insert_failure_not_connected(), test_insert_success(), test_metrics_api(), test_metrics_structure(), test_metrics_update_on_query(), test_move_semantics(), test_query_param_null_safety(), test_query_parameters(), test_query_result_structure(), test_remove_failure_not_connected(), test_remove_success(), test_reset_metrics(), test_select_failure_not_connected(), test_select_success(), test_thread_safety_health_checks(), test_thread_safety_metrics(), test_transaction_commit(), test_transaction_execute(), test_transaction_is_active(), test_transaction_metrics(), test_transaction_raii_cleanup(), test_transaction_rollback(), test_update_failure_not_connected(), test_update_success(), and test_zero_config_construction().
| int main | ( | ) |
Definition at line 1239 of file test_unified_database_system.cpp.
References test_begin_transaction_failure(), test_begin_transaction_success(), test_builder_custom(), test_builder_default(), test_config_construction(), test_connect_mock_backend(), test_connect_typed_backend(), test_connect_unsupported_backend(), test_connection_state_api(), test_create_query_builder(), test_error_handling_no_connection(), test_execute_success(), test_execute_transaction_failure(), test_execute_transaction_success(), test_get_backend_type(), test_get_config(), test_get_pool_stats(), test_health_check_api(), test_health_check_structure(), test_insert_failure_not_connected(), test_insert_success(), test_metrics_api(), test_metrics_structure(), test_metrics_update_on_query(), test_move_semantics(), test_query_param_null_safety(), test_query_parameters(), test_query_result_structure(), test_remove_failure_not_connected(), test_remove_success(), test_reset_metrics(), test_select_failure_not_connected(), test_select_success(), test_thread_safety_health_checks(), test_thread_safety_metrics(), test_transaction_commit(), test_transaction_execute(), test_transaction_is_active(), test_transaction_metrics(), test_transaction_raii_cleanup(), test_transaction_rollback(), test_update_failure_not_connected(), test_update_success(), test_zero_config_construction(), tests_failed, and tests_passed.

| bool test_begin_transaction_failure | ( | ) |
Definition at line 861 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), TEST_END, and TEST_START.
Referenced by main().


| bool test_begin_transaction_success | ( | ) |
Definition at line 839 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_builder_custom | ( | ) |
Definition at line 171 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::builder::build(), database::integrated::unified_database_system::create_builder(), database::integrated::unified_database_system::builder::enable_async(), database::integrated::unified_database_system::builder::enable_logging(), database::integrated::unified_database_system::builder::enable_monitoring(), database::integrated::unified_database_system::builder::set_backend(), database::integrated::unified_database_system::builder::set_connection_string(), database::integrated::unified_database_system::builder::set_pool_size(), database::integrated::unified_database_system::builder::set_slow_query_threshold(), TEST_END, and TEST_START.
Referenced by main().


| bool test_builder_default | ( | ) |
Definition at line 154 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::create_builder(), TEST_END, and TEST_START.
Referenced by main().


| bool test_config_construction | ( | ) |
Definition at line 216 of file test_unified_database_system.cpp.
References ASSERT_FALSE, database::integrated::unified_db_config::connection_pool, database::integrated::unified_db_config::database, database::integrated::db_monitoring_config::enable_metrics, database::integrated::db_logger_config::enable_query_logging, database::integrated::unified_database_system::is_connected(), database::integrated::unified_db_config::logger, database::integrated::pool_config::max_connections, database::integrated::pool_config::min_connections, database::integrated::unified_db_config::monitoring, TEST_END, TEST_START, and database::integrated::database_config::type.
Referenced by main().


| bool test_connect_mock_backend | ( | ) |
Definition at line 596 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::disconnect(), database::integrated::unified_database_system::is_connected(), TEST_END, and TEST_START.
Referenced by main().


| bool test_connect_typed_backend | ( | ) |
Definition at line 617 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::is_connected(), TEST_END, and TEST_START.
Referenced by main().


| bool test_connect_unsupported_backend | ( | ) |
Definition at line 634 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::is_connected(), TEST_END, and TEST_START.
Referenced by main().


| bool test_connection_state_api | ( | ) |
Definition at line 266 of file test_unified_database_system.cpp.
References ASSERT_FALSE, database::integrated::unified_database_system::disconnect(), database::integrated::unified_database_system::is_connected(), TEST_END, and TEST_START.
Referenced by main().


| bool test_create_query_builder | ( | ) |
Definition at line 1169 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::create_query_builder(), TEST_END, and TEST_START.
Referenced by main().


| bool test_error_handling_no_connection | ( | ) |
Definition at line 575 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::execute(), TEST_END, and TEST_START.
Referenced by main().


| bool test_execute_success | ( | ) |
Definition at line 655 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::execute(), TEST_END, and TEST_START.
Referenced by main().


| bool test_execute_transaction_failure | ( | ) |
Definition at line 1044 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::execute_transaction(), TEST_END, and TEST_START.
Referenced by main().


| bool test_execute_transaction_success | ( | ) |
Definition at line 1020 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::execute_transaction(), TEST_END, and TEST_START.
Referenced by main().


| bool test_get_backend_type | ( | ) |
Definition at line 1090 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::get_backend_type(), TEST_END, and TEST_START.
Referenced by main().


| bool test_get_config | ( | ) |
Definition at line 1065 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_db_config::connection_pool, database::integrated::unified_db_config::database, database::integrated::unified_database_system::get_config(), database::integrated::pool_config::max_connections, database::integrated::pool_config::min_connections, TEST_END, TEST_START, and database::integrated::database_config::type.
Referenced by main().


| bool test_get_pool_stats | ( | ) |
Definition at line 1106 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::get_pool_stats(), TEST_END, and TEST_START.
Referenced by main().


| bool test_health_check_api | ( | ) |
Definition at line 289 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::check_health(), TEST_END, and TEST_START.
Referenced by main().


| bool test_health_check_structure | ( | ) |
Definition at line 480 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::health_check::connection_pool_utilization, database::integrated::health_check::is_connected, database::integrated::health_check::issues, database::integrated::health_check::logger_healthy, database::integrated::health_check::monitor_healthy, database::integrated::health_check::status, TEST_END, TEST_START, and database::integrated::health_check::thread_pool_healthy.
Referenced by main().

| bool test_insert_failure_not_connected | ( | ) |
Definition at line 740 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::insert(), TEST_END, and TEST_START.
Referenced by main().


| bool test_insert_success | ( | ) |
Definition at line 719 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::insert(), TEST_END, and TEST_START.
Referenced by main().


| bool test_metrics_api | ( | ) |
Definition at line 314 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::get_metrics(), TEST_END, and TEST_START.
Referenced by main().


| bool test_metrics_structure | ( | ) |
Definition at line 452 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::database_metrics::failed_queries, database::integrated::database_metrics::pool_size, database::integrated::database_metrics::queries_per_second, database::integrated::database_metrics::successful_queries, TEST_END, TEST_START, database::integrated::database_metrics::total_queries, and database::integrated::database_metrics::transactions_started.
Referenced by main().

| bool test_metrics_update_on_query | ( | ) |
Definition at line 1185 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::execute(), database::integrated::unified_database_system::get_metrics(), database::integrated::unified_database_system::reset_metrics(), TEST_END, and TEST_START.
Referenced by main().


| bool test_move_semantics | ( | ) |
Definition at line 237 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::builder::build(), database::integrated::unified_database_system::create_builder(), database::integrated::unified_database_system::builder::set_backend(), TEST_END, and TEST_START.
Referenced by main().


| bool test_query_param_null_safety | ( | ) |
Definition at line 402 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::query_param::get_value(), database::integrated::query_param::is_null(), TEST_END, TEST_START, and database::integrated::query_param::to_sql_string().
Referenced by main().


| bool test_query_parameters | ( | ) |
Definition at line 373 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, TEST_END, and TEST_START.
Referenced by main().

| bool test_query_result_structure | ( | ) |
Definition at line 335 of file test_unified_database_system.cpp.
References database::integrated::query_result::affected_rows, ASSERT_FALSE, ASSERT_TRUE, database::integrated::query_result::empty(), database::integrated::query_result::rows, database::integrated::query_result::size(), TEST_END, and TEST_START.
Referenced by main().


| bool test_remove_failure_not_connected | ( | ) |
Definition at line 820 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::remove(), TEST_END, and TEST_START.
Referenced by main().


| bool test_remove_success | ( | ) |
Definition at line 799 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::remove(), TEST_END, and TEST_START.
Referenced by main().


| bool test_reset_metrics | ( | ) |
Definition at line 1135 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::execute(), database::integrated::unified_database_system::get_metrics(), database::integrated::unified_database_system::reset_metrics(), TEST_END, and TEST_START.
Referenced by main().


| bool test_select_failure_not_connected | ( | ) |
Definition at line 700 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::select(), TEST_END, and TEST_START.
Referenced by main().


| bool test_select_success | ( | ) |
Definition at line 678 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::select(), TEST_END, and TEST_START.
Referenced by main().


| bool test_thread_safety_health_checks | ( | ) |
Definition at line 511 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::check_health(), TEST_END, and TEST_START.
Referenced by main().


| bool test_thread_safety_metrics | ( | ) |
Definition at line 544 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::get_metrics(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_commit | ( | ) |
Definition at line 902 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_execute | ( | ) |
Definition at line 880 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_is_active | ( | ) |
Definition at line 952 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_metrics | ( | ) |
Definition at line 1211 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), database::integrated::unified_database_system::get_metrics(), database::integrated::unified_database_system::reset_metrics(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_raii_cleanup | ( | ) |
Definition at line 991 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_transaction_rollback | ( | ) |
Definition at line 927 of file test_unified_database_system.cpp.
References ASSERT_FALSE, ASSERT_TRUE, database::integrated::unified_database_system::begin_transaction(), database::integrated::unified_database_system::connect(), TEST_END, and TEST_START.
Referenced by main().


| bool test_update_failure_not_connected | ( | ) |
Definition at line 780 of file test_unified_database_system.cpp.
References ASSERT_TRUE, TEST_END, TEST_START, and database::integrated::unified_database_system::update().
Referenced by main().


| bool test_update_success | ( | ) |
Definition at line 759 of file test_unified_database_system.cpp.
References ASSERT_TRUE, database::integrated::unified_database_system::connect(), TEST_END, TEST_START, and database::integrated::unified_database_system::update().
Referenced by main().


| bool test_zero_config_construction | ( | ) |
Definition at line 200 of file test_unified_database_system.cpp.
References ASSERT_FALSE, database::integrated::unified_database_system::is_connected(), TEST_END, and TEST_START.
Referenced by main().


|
static |
Definition at line 27 of file test_unified_database_system.cpp.
Referenced by main().
|
static |
Definition at line 26 of file test_unified_database_system.cpp.
Referenced by main().