diff --git a/build/Jamfile b/build/Jamfile index e58d0a24..d7c83f62 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -12,29 +12,41 @@ PRG_EXEC_MON_SOURCES = ; TEST_EXEC_MON_SOURCES = - execution_monitor - test_tools - unit_test_parameters - unit_test_log - unit_test_monitor - unit_test_result - unit_test_suite compiler_log_formatter - xml_log_formatter + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter test_main + test_tools + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + unit_test_suite + xml_log_formatter + xml_report_formatter ; UTF_SOURCES = - execution_monitor - test_tools - unit_test_parameters - unit_test_log - unit_test_monitor - unit_test_result - unit_test_suite - unit_test_main compiler_log_formatter + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter + test_main + test_tools + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + unit_test_suite xml_log_formatter + xml_report_formatter ; template boost_test_lib diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index ffe44289..a9fec3b1 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -16,29 +16,40 @@ PRG_EXEC_MON_SOURCES = ; TEST_EXEC_MON_SOURCES = - execution_monitor - test_tools - unit_test_parameters - unit_test_log - unit_test_monitor - unit_test_result - unit_test_suite - test_main compiler_log_formatter + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter + test_main + test_tools + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + unit_test_suite xml_log_formatter + xml_report_formatter ; UTF_SOURCES = - execution_monitor - test_tools - unit_test_parameters - unit_test_log - unit_test_monitor - unit_test_result - unit_test_suite - unit_test_main compiler_log_formatter + execution_monitor + framework + plain_report_formatter + progress_monitor + results_collector + results_reporter + test_tools + unit_test_log + unit_test_main + unit_test_monitor + unit_test_parameters + unit_test_suite xml_log_formatter + xml_report_formatter ; lib boost_prg_exec_monitor : $(PRG_EXEC_MON_SOURCES).cpp diff --git a/build/msvc71_proj/algorithms_test.vcproj b/build/msvc71_proj/algorithms_test.vcproj index 8556d949..5ade99d3 100755 --- a/build/msvc71_proj/algorithms_test.vcproj +++ b/build/msvc71_proj/algorithms_test.vcproj @@ -1,175 +1,175 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/auto_unit_test_test.vcproj b/build/msvc71_proj/auto_unit_test_test.vcproj index 4a5be78d..17e6503f 100644 --- a/build/msvc71_proj/auto_unit_test_test.vcproj +++ b/build/msvc71_proj/auto_unit_test_test.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/auto_unit_test_test_mult.vcproj b/build/msvc71_proj/auto_unit_test_test_mult.vcproj index 2cfe9183..df431e05 100644 --- a/build/msvc71_proj/auto_unit_test_test_mult.vcproj +++ b/build/msvc71_proj/auto_unit_test_test_mult.vcproj @@ -1,161 +1,161 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/basic_cstring_test.vcproj b/build/msvc71_proj/basic_cstring_test.vcproj index 527db962..06bdf4f8 100644 --- a/build/msvc71_proj/basic_cstring_test.vcproj +++ b/build/msvc71_proj/basic_cstring_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/boost_test_library.sln b/build/msvc71_proj/boost_test_library.sln index f593cadb..f40103aa 100644 --- a/build/msvc71_proj/boost_test_library.sln +++ b/build/msvc71_proj/boost_test_library.sln @@ -129,14 +129,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit_test_framework", "unit ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unit_test_suite_ex_test", "unit_test_suite_ex_test.vcproj", "{643A15A4-F17F-4ACE-AB83-167AA2160BEC}" - ProjectSection(ProjectDependencies) = postProject - {9466C117-7AE0-4AFD-B327-E1612568BCF1} = {9466C117-7AE0-4AFD-B327-E1612568BCF1} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_case_template_test", "test_case_template_test.vcproj", "{CBB6EB43-0BE0-44E9-A4B4-B4B8437410D9}" ProjectSection(ProjectDependencies) = postProject - {30AE2EB6-0F78-4D13-9D67-AA5A1052B4C7} = {30AE2EB6-0F78-4D13-9D67-AA5A1052B4C7} + {9466C117-7AE0-4AFD-B327-E1612568BCF1} = {9466C117-7AE0-4AFD-B327-E1612568BCF1} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "auto_unit_test_test_mult", "auto_unit_test_test_mult.vcproj", "{E782C9A9-A9AC-41AA-82C1-5ECF8798ED81}" @@ -297,10 +292,6 @@ Global {9466C117-7AE0-4AFD-B327-E1612568BCF1}.Debug.Build.0 = Debug|Win32 {9466C117-7AE0-4AFD-B327-E1612568BCF1}.Release.ActiveCfg = Release|Win32 {9466C117-7AE0-4AFD-B327-E1612568BCF1}.Release.Build.0 = Release|Win32 - {643A15A4-F17F-4ACE-AB83-167AA2160BEC}.Debug.ActiveCfg = Debug|Win32 - {643A15A4-F17F-4ACE-AB83-167AA2160BEC}.Debug.Build.0 = Debug|Win32 - {643A15A4-F17F-4ACE-AB83-167AA2160BEC}.Release.ActiveCfg = Release|Win32 - {643A15A4-F17F-4ACE-AB83-167AA2160BEC}.Release.Build.0 = Release|Win32 {CBB6EB43-0BE0-44E9-A4B4-B4B8437410D9}.Debug.ActiveCfg = Debug|Win32 {CBB6EB43-0BE0-44E9-A4B4-B4B8437410D9}.Debug.Build.0 = Debug|Win32 {CBB6EB43-0BE0-44E9-A4B4-B4B8437410D9}.Release.ActiveCfg = Release|Win32 diff --git a/build/msvc71_proj/class_properties_test.vcproj b/build/msvc71_proj/class_properties_test.vcproj index da3afb76..00be3776 100644 --- a/build/msvc71_proj/class_properties_test.vcproj +++ b/build/msvc71_proj/class_properties_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/custom_exception_test.vcproj b/build/msvc71_proj/custom_exception_test.vcproj index cbce0046..3789c69f 100755 --- a/build/msvc71_proj/custom_exception_test.vcproj +++ b/build/msvc71_proj/custom_exception_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/errors_handling_test.vcproj b/build/msvc71_proj/errors_handling_test.vcproj index 3830d753..09c55b68 100644 --- a/build/msvc71_proj/errors_handling_test.vcproj +++ b/build/msvc71_proj/errors_handling_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/exec_mon_example.vcproj b/build/msvc71_proj/exec_mon_example.vcproj index 4c925b7c..78a2674e 100755 --- a/build/msvc71_proj/exec_mon_example.vcproj +++ b/build/msvc71_proj/exec_mon_example.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/fixed_mapping_test.vcproj b/build/msvc71_proj/fixed_mapping_test.vcproj index 57b4e071..a4369f48 100644 --- a/build/msvc71_proj/fixed_mapping_test.vcproj +++ b/build/msvc71_proj/fixed_mapping_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/ifstream_line_it_tst.vcproj b/build/msvc71_proj/ifstream_line_it_tst.vcproj index 1b6f29c8..cced1ad7 100755 --- a/build/msvc71_proj/ifstream_line_it_tst.vcproj +++ b/build/msvc71_proj/ifstream_line_it_tst.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/minimal_test.vcproj b/build/msvc71_proj/minimal_test.vcproj index a41b671d..579e9a9d 100644 --- a/build/msvc71_proj/minimal_test.vcproj +++ b/build/msvc71_proj/minimal_test.vcproj @@ -1,177 +1,177 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/online_test.vcproj b/build/msvc71_proj/online_test.vcproj index 2d422458..17466363 100644 --- a/build/msvc71_proj/online_test.vcproj +++ b/build/msvc71_proj/online_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/output_test_stream_test.vcproj b/build/msvc71_proj/output_test_stream_test.vcproj index 80f4434a..72d2ae04 100644 --- a/build/msvc71_proj/output_test_stream_test.vcproj +++ b/build/msvc71_proj/output_test_stream_test.vcproj @@ -1,176 +1,176 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/parameterized_test_test.vcproj b/build/msvc71_proj/parameterized_test_test.vcproj index 503e074a..5cd40243 100644 --- a/build/msvc71_proj/parameterized_test_test.vcproj +++ b/build/msvc71_proj/parameterized_test_test.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/prg_exec_example.vcproj b/build/msvc71_proj/prg_exec_example.vcproj index b8aeed2c..2d1990db 100644 --- a/build/msvc71_proj/prg_exec_example.vcproj +++ b/build/msvc71_proj/prg_exec_example.vcproj @@ -1,172 +1,172 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/prg_exec_fail1.vcproj b/build/msvc71_proj/prg_exec_fail1.vcproj index 256811da..df6574c5 100644 --- a/build/msvc71_proj/prg_exec_fail1.vcproj +++ b/build/msvc71_proj/prg_exec_fail1.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/prg_exec_fail2.vcproj b/build/msvc71_proj/prg_exec_fail2.vcproj index 7f77a059..d52b9522 100644 --- a/build/msvc71_proj/prg_exec_fail2.vcproj +++ b/build/msvc71_proj/prg_exec_fail2.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/prg_exec_fail3.vcproj b/build/msvc71_proj/prg_exec_fail3.vcproj index fe41ffae..7148bb8a 100644 --- a/build/msvc71_proj/prg_exec_fail3.vcproj +++ b/build/msvc71_proj/prg_exec_fail3.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/prg_exec_monitor.vcproj b/build/msvc71_proj/prg_exec_monitor.vcproj index 28a60e73..15f7d87b 100644 --- a/build/msvc71_proj/prg_exec_monitor.vcproj +++ b/build/msvc71_proj/prg_exec_monitor.vcproj @@ -1,179 +1,179 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/result_report_test.vcproj b/build/msvc71_proj/result_report_test.vcproj index 2cc1e18e..dce09727 100644 --- a/build/msvc71_proj/result_report_test.vcproj +++ b/build/msvc71_proj/result_report_test.vcproj @@ -1,171 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_case_template_ex.vcproj b/build/msvc71_proj/test_case_template_ex.vcproj index f8946e12..7bb7894c 100755 --- a/build/msvc71_proj/test_case_template_ex.vcproj +++ b/build/msvc71_proj/test_case_template_ex.vcproj @@ -1,171 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_case_template_test.vcproj b/build/msvc71_proj/test_case_template_test.vcproj index 1f1b550f..a99971e2 100644 --- a/build/msvc71_proj/test_case_template_test.vcproj +++ b/build/msvc71_proj/test_case_template_test.vcproj @@ -1,175 +1,175 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_example.vcproj b/build/msvc71_proj/test_exec_example.vcproj index 8cbe098c..27036ced 100644 --- a/build/msvc71_proj/test_exec_example.vcproj +++ b/build/msvc71_proj/test_exec_example.vcproj @@ -1,171 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_fail1.vcproj b/build/msvc71_proj/test_exec_fail1.vcproj index 95f0e9a4..53e95049 100644 --- a/build/msvc71_proj/test_exec_fail1.vcproj +++ b/build/msvc71_proj/test_exec_fail1.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_fail2.vcproj b/build/msvc71_proj/test_exec_fail2.vcproj index 6614eb13..2796e359 100644 --- a/build/msvc71_proj/test_exec_fail2.vcproj +++ b/build/msvc71_proj/test_exec_fail2.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_fail3.vcproj b/build/msvc71_proj/test_exec_fail3.vcproj index 9e648bab..0444de38 100644 --- a/build/msvc71_proj/test_exec_fail3.vcproj +++ b/build/msvc71_proj/test_exec_fail3.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_fail4.vcproj b/build/msvc71_proj/test_exec_fail4.vcproj index 5f64deeb..dedb6f70 100644 --- a/build/msvc71_proj/test_exec_fail4.vcproj +++ b/build/msvc71_proj/test_exec_fail4.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_exec_monitor.vcproj b/build/msvc71_proj/test_exec_monitor.vcproj index f37f2061..9f4bcb1d 100644 --- a/build/msvc71_proj/test_exec_monitor.vcproj +++ b/build/msvc71_proj/test_exec_monitor.vcproj @@ -1,330 +1,400 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_fp_comparisons.vcproj b/build/msvc71_proj/test_fp_comparisons.vcproj index 2ea2a220..15d09ab8 100644 --- a/build/msvc71_proj/test_fp_comparisons.vcproj +++ b/build/msvc71_proj/test_fp_comparisons.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/test_tools_test.vcproj b/build/msvc71_proj/test_tools_test.vcproj index d95caf69..2c39222a 100644 --- a/build/msvc71_proj/test_tools_test.vcproj +++ b/build/msvc71_proj/test_tools_test.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/token_iterator_test.vcproj b/build/msvc71_proj/token_iterator_test.vcproj index aafe6e2a..b3fc8521 100755 --- a/build/msvc71_proj/token_iterator_test.vcproj +++ b/build/msvc71_proj/token_iterator_test.vcproj @@ -1,174 +1,174 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_example1.vcproj b/build/msvc71_proj/unit_test_example1.vcproj index 0cfaedbf..7a11e2a4 100644 --- a/build/msvc71_proj/unit_test_example1.vcproj +++ b/build/msvc71_proj/unit_test_example1.vcproj @@ -1,172 +1,172 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_example2.vcproj b/build/msvc71_proj/unit_test_example2.vcproj index 1b448cdf..4e679201 100644 --- a/build/msvc71_proj/unit_test_example2.vcproj +++ b/build/msvc71_proj/unit_test_example2.vcproj @@ -1,171 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_example3.vcproj b/build/msvc71_proj/unit_test_example3.vcproj index f96dcd53..562258bb 100644 --- a/build/msvc71_proj/unit_test_example3.vcproj +++ b/build/msvc71_proj/unit_test_example3.vcproj @@ -1,171 +1,171 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_example4.vcproj b/build/msvc71_proj/unit_test_example4.vcproj index d33fbd6e..81cefd5b 100644 --- a/build/msvc71_proj/unit_test_example4.vcproj +++ b/build/msvc71_proj/unit_test_example4.vcproj @@ -1,172 +1,172 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_example5.vcproj b/build/msvc71_proj/unit_test_example5.vcproj index bb8a608f..ba2d145d 100644 --- a/build/msvc71_proj/unit_test_example5.vcproj +++ b/build/msvc71_proj/unit_test_example5.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_framework.vcproj b/build/msvc71_proj/unit_test_framework.vcproj index 83ee8037..1e8c8513 100644 --- a/build/msvc71_proj/unit_test_framework.vcproj +++ b/build/msvc71_proj/unit_test_framework.vcproj @@ -1,416 +1,415 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/msvc71_proj/unit_test_suite_ex_test.vcproj b/build/msvc71_proj/unit_test_suite_ex_test.vcproj index ea05d3d5..b1f17c57 100644 --- a/build/msvc71_proj/unit_test_suite_ex_test.vcproj +++ b/build/msvc71_proj/unit_test_suite_ex_test.vcproj @@ -1,173 +1,173 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/exec_mon_example.cpp b/example/exec_mon_example.cpp index bd52c10e..8766b2b9 100644 --- a/example/exec_mon_example.cpp +++ b/example/exec_mon_example.cpp @@ -6,6 +6,7 @@ // See http://www.boost.org/libs/test for the library home page. #include +#include #include @@ -23,11 +24,13 @@ struct my_exception2 int m_res_code; }; -struct dangerous_call_monitor : boost::execution_monitor -{ - explicit dangerous_call_monitor( int argc ) : m_argc( argc ) {} +namespace { - virtual int function() +class dangerous_call { +public: + dangerous_call( int argc ) : m_argc( argc ) {} + + int operator()() { // here we perform some operation under monitoring that could throw my_exception if( m_argc < 2 ) @@ -40,7 +43,9 @@ struct dangerous_call_monitor : boost::execution_monitor return 1; } - int m_argc; +private: + // Data members + int m_argc; }; void translate_my_exception1( my_exception1 const& ex ) @@ -53,16 +58,18 @@ void translate_my_exception2( my_exception2 const& ex ) std::cout << "Caught my_exception2(" << ex.m_res_code << ")"<< std::endl; } +} // local_namespace + int main( int argc , char *[] ) { - dangerous_call_monitor the_monitor( argc ); + ::boost::execution_monitor ex_mon; - the_monitor.register_exception_translator( &translate_my_exception1 ); - the_monitor.register_exception_translator( &translate_my_exception2 ); + ex_mon.register_exception_translator( &translate_my_exception1 ); + ex_mon.register_exception_translator( &translate_my_exception2 ); try { - the_monitor.execute(); + ex_mon.execute( ::boost::unit_test::callback0( dangerous_call( argc ) ) ); } catch ( boost::execution_exception const& ex ) { std::cout << "Caught exception: " << ex.what() << std::endl; diff --git a/example/test_case_template_example.cpp b/example/test_case_template_example.cpp index 1aa89fb0..0bfdea80 100644 --- a/example/test_case_template_example.cpp +++ b/example/test_case_template_example.cpp @@ -13,20 +13,18 @@ using boost::unit_test::test_suite; // Boost.MPL #include -template -void free_test_function( Number* = 0 ) { +BOOST_TEST_CASE_TEMPLATE_FUNCTION( free_test_function, Number ) +{ BOOST_CHECK_EQUAL( 2, (int const)Number::value ); } -BOOST_META_FUNC_TEST_CASE( free_test_function ); - test_suite* init_unit_test_suite( int, char* [] ) { test_suite* test= BOOST_TEST_SUITE( "Test case template example" ); typedef boost::mpl::range_c numbers; - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( free_test_function, numbers ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( free_test_function, numbers ) ); return test; } diff --git a/example/unit_test_example3.cpp b/example/unit_test_example3.cpp index f36994d8..a23dda12 100644 --- a/example/unit_test_example3.cpp +++ b/example/unit_test_example3.cpp @@ -1,6 +1,5 @@ -// (C) Copyright Gennadiy Rozental 2002-2004. -// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001. // (C) Copyright Gennadiy Rozental 2001-2004. +// (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +11,7 @@ #include using boost::unit_test::test_suite; using boost::unit_test::test_case; -using boost::test_toolbox::close_at_tolerance; +using boost::test_tools::close_at_tolerance; // BOOST #include @@ -127,7 +126,7 @@ struct account_test_suite : public test_suite { test_case* withdraw_test_case = BOOST_CLASS_TEST_CASE( &account_test::test_withdraw, instance ); deposit_test_case->depends_on( init_test_case ); - withdraw_test_case->depends_on( init_test_case ); + withdraw_test_case->depends_on( deposit_test_case ); add( init_test_case, 1 ); add( deposit_test_case, 1 ); @@ -137,7 +136,7 @@ struct account_test_suite : public test_suite { test_suite* init_unit_test_suite( int argc, char * argv[] ) { - std::auto_ptr test( BOOST_TEST_SUITE( "Unit test example 3" ) ); + test_suite* test( BOOST_TEST_SUITE( "Unit test example 3" ) ); try { if( argc < 2 ) @@ -149,7 +148,7 @@ init_unit_test_suite( int argc, char * argv[] ) { return (test_suite*)0; } - return test.release(); + return test; } // EOF diff --git a/example/unit_test_example4.cpp b/example/unit_test_example4.cpp index 9fcdbd25..1f0dcbbe 100644 --- a/example/unit_test_example4.cpp +++ b/example/unit_test_example4.cpp @@ -8,6 +8,7 @@ // Boost.Test #include +#include using boost::unit_test::test_suite; // STL @@ -20,15 +21,13 @@ void check_string( std::string const& s ) BOOST_CHECK_EQUAL( s.substr( 0, 3 ), "hdr" ); } -namespace { - std::string const params[] = { "hdr1 ", "hdr2", "3 " }; -} - test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { test_suite* test= BOOST_TEST_SUITE( "Unit test example 4" ); - test->add( BOOST_PARAM_TEST_CASE( &check_string, (std::string const*)params, params+3 ), 1 ); + std::string const params[] = { "hdr1 ", "hdr2", "3 " }; + + test->add( BOOST_PARAM_TEST_CASE( &check_string, (std::string const*)params, params+3 ) ); return test; } diff --git a/example/unit_test_example5.cpp b/example/unit_test_example5.cpp index 8eef4402..a111c118 100644 --- a/example/unit_test_example5.cpp +++ b/example/unit_test_example5.cpp @@ -8,15 +8,19 @@ // Boost.Test #include #include +#include using boost::unit_test::test_suite; // BOOST #include #include +#include +#include // STL #include #include +#include #include #include #include @@ -147,24 +151,33 @@ struct massive_hash_function_test : test_suite { std::cout << "Enter test data in a format [string] -1 to check long string validation\n"; std::cout << "Enter test data in a format [string] -2 to check invalid argument string validation\n"; + std::list test_data_store; + while( !std::cin.eof() ) { hash_function_test_data test_data; if( !(std::cin >> test_data) ) break; - m_test_data.push_back( test_data ); + test_data_store.push_back( test_data ); } - add( BOOST_PARAM_CLASS_TEST_CASE( &hash_function_tester::test, instance, m_test_data.begin(), m_test_data.end() ) ); - } + boost::unit_test::callback1 test_func( + boost::bind( boost::mem_fn( &hash_function_tester::test ), instance ) ); - std::list m_test_data; + add( boost::unit_test::make_test_case( + test_func, + "massive_hash_function_test", + test_data_store.begin(), + test_data_store.end() ) ); + } }; +//____________________________________________________________________________// + test_suite* init_unit_test_suite( int argc, char * argv[] ) { - std::auto_ptr test( BOOST_TEST_SUITE( "Unit test example 5" ) ); + test_suite* test( BOOST_TEST_SUITE( "Unit test example 5" ) ); try { test->add( new massive_hash_function_test ); @@ -174,7 +187,9 @@ init_unit_test_suite( int argc, char * argv[] ) { return (test_suite*)0; } - return test.release(); + return test; } +//____________________________________________________________________________// + // EOF diff --git a/include/boost/test/auto_unit_test.hpp b/include/boost/test/auto_unit_test.hpp index 64b9a92c..2ca0bc7f 100644 --- a/include/boost/test/auto_unit_test.hpp +++ b/include/boost/test/auto_unit_test.hpp @@ -13,12 +13,16 @@ // for simple function based test cases // *************************************************************************** -#ifndef BOOST_AUTO_UNIT_TEST_HPP_071894GER -#define BOOST_AUTO_UNIT_TEST_HPP_071894GER +#ifndef BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER +#define BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER // Boost.Test #include +#include + +//____________________________________________________________________________// + // ************************************************************************** // // ************** auto_unit_test_registrar ************** // // ************************************************************************** // @@ -38,7 +42,14 @@ auto_unit_test_suite() struct auto_unit_test_registrar { // Constructor - explicit auto_unit_test_registrar( test_case* tc ) { auto_unit_test_suite()->add( tc ); } + explicit auto_unit_test_registrar( test_case* tc ) + { + auto_unit_test_suite()->add( tc ); + } + explicit auto_unit_test_registrar( test_unit_generator const& tc_gen ) + { + auto_unit_test_suite()->add( tc_gen ); + } }; } // namespace ut_detail @@ -48,15 +59,39 @@ struct auto_unit_test_registrar } // namespace boost // ************************************************************************** // -// ************** BOOST_AUTO_UNIT_TEST ************** // +// ************** BOOST_AUTO_TEST_CASE ************** // // ************************************************************************** // -#define BOOST_AUTO_UNIT_TEST( func_name ) \ -static void func_name(); \ -static boost::unit_test::ut_detail::auto_unit_test_registrar \ - BOOST_JOIN( test_registrar, __LINE__) \ - ( BOOST_TEST_CASE( func_name ) ); \ -static void func_name() \ +#define BOOST_AUTO_TEST_CASE( func_name ) \ +static void func_name(); \ +static boost::unit_test::ut_detail::auto_unit_test_registrar \ +BOOST_JOIN( test_registrar, __LINE__) \ + ( BOOST_TEST_CASE( func_name ) ); \ +static void func_name() \ +/**/ + +// ************************************************************************** // +// ************** BOOST_AUTO_TEST_CASE_TEMPLATE ************** // +// ************************************************************************** // + +#define BOOST_AUTO_TEST_CASE_TEMPLATE( name, type_name, TL ) \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ); \ + \ +struct name { \ + template \ + static void run( boost::type* frwrd = 0 ) \ + { \ + BOOST_JOIN( name, _impl )( frwrd ); \ + } \ +}; \ + \ +static boost::unit_test::ut_detail::auto_unit_test_registrar \ +BOOST_JOIN( test_registrar, __LINE__) \ + ( BOOST_TEST_CASE_TEMPLATE( name, TL ) ); \ + \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ) \ /**/ // ************************************************************************** // @@ -70,10 +105,22 @@ init_unit_test_suite( int /* argc */, char* /* argv */ [] ) { } #endif + +// deprecated +#define BOOST_AUTO_UNIT_TEST( f ) BOOST_AUTO_TEST_CASE( f ) + + +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.13 2005/02/20 08:27:05 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.12 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed @@ -82,4 +129,4 @@ init_unit_test_suite( int /* argc */, char* /* argv */ [] ) { // // *************************************************************************** -#endif // BOOST_AUTO_UNIT_TEST_HPP_071894GER +#endif // BOOST_TEST_AUTO_UNIT_TEST_HPP_071894GER diff --git a/include/boost/test/detail/unit_test_config.hpp b/include/boost/test/detail/config.hpp similarity index 66% rename from include/boost/test/detail/unit_test_config.hpp rename to include/boost/test/detail/config.hpp index cd3659ba..ebec4b32 100644 --- a/include/boost/test/detail/unit_test_config.hpp +++ b/include/boost/test/detail/config.hpp @@ -9,14 +9,14 @@ // // Version : $Revision$ // -// Description : contains workarounds and works as a central place for configurable types +// Description : as a central place for global configuration switches // *************************************************************************** -#ifndef BOOST_UNIT_TEST_CONFIG_HPP_071894GER -#define BOOST_UNIT_TEST_CONFIG_HPP_071894GER +#ifndef BOOST_TEST_CONFIG_HPP_071894GER +#define BOOST_TEST_CONFIG_HPP_071894GER // Boost -#include // compilers workarounds and std::ptrdiff_t +#include // compilers workarounds #include #if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) @@ -25,29 +25,30 @@ #define BOOST_STANDARD_IOSTREAMS #endif +//____________________________________________________________________________// + #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) || \ BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) || \ (defined __sgi && BOOST_WORKAROUND(_COMPILER_VERSION, BOOST_TESTED_AT(730))) #define BOOST_TEST_SHIFTED_LINE #endif +//____________________________________________________________________________// + #if defined(BOOST_MSVC) || (defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)) # define BOOST_TEST_CALL_DECL __cdecl #else # define BOOST_TEST_CALL_DECL /**/ #endif -// Boost.Test -#include -#include -#define BOOST_TEST_STRING_LITERAL( s ) boost::unit_test::literal_string( s, sizeof( s ) - 1 ) -#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_STRING_LITERAL( BOOST_STRINGIZE( s ) ) -#define BOOST_TEST_EMPTY_STRING BOOST_TEST_STRING_LITERAL( "" ) +//____________________________________________________________________________// #if defined(BOOST_HAS_SIGACTION) #define BOOST_TEST_SUPPORT_TIMEOUT #endif +//____________________________________________________________________________// + #if BOOST_WORKAROUND(__BORLANDC__, <= 0x570) || \ BOOST_WORKAROUND( __COMO__, <= 0x433 ) || \ BOOST_WORKAROUND( __INTEL_COMPILER, <= 800 ) || \ @@ -58,46 +59,19 @@ #define BOOST_TEST_NO_PROTECTED_USING #endif -// STL -#include // for std::distance -#include // for std::ptrdiff_t +//____________________________________________________________________________// -namespace boost { +#define BOOST_TEST_PROTECTED_VIRTUAL virtual -namespace unit_test { - -typedef unsigned long counter_t; - -namespace ut_detail { - -#ifdef BOOST_NO_STD_DISTANCE -template -std::ptrdiff_t distance( T const& x_, T const& y_ ) -{ - std::ptrdiff_t res = 0; - - std::distance( x_, y_, res ); - - return res; -} -#else -using std::distance; -#endif - -#define BOOST_TEST_L( s ) const_string( s, sizeof(s) ) - -} // namespace ut_detail - -} // namespace unit_test - -namespace unit_test_framework = unit_test; - -} // namespace boost +//____________________________________________________________________________// // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.28 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed @@ -119,4 +93,4 @@ namespace unit_test_framework = unit_test; // // *************************************************************************** -#endif // BOOST_UNIT_TEST_CONFIG_HPP_071894GER +#endif // BOOST_TEST_CONFIG_HPP_071894GER diff --git a/include/boost/test/detail/enable_warnings.hpp b/include/boost/test/detail/enable_warnings.hpp index 513a9a0e..738b71f6 100644 --- a/include/boost/test/detail/enable_warnings.hpp +++ b/include/boost/test/detail/enable_warnings.hpp @@ -17,6 +17,8 @@ # pragma warning(default: 4512) // assignment operator could not be generated # pragma warning(default: 4100) // unreferenced formal parameter # pragma warning(default: 4996) // was declared deprecated +# pragma warning(default: 4355) // 'this' : used in base member initializer list +# pragma warning(default: 4706) // assignment within conditional expression # pragma warning(pop) #endif @@ -24,6 +26,9 @@ // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/fwd_decl.hpp b/include/boost/test/detail/fwd_decl.hpp similarity index 62% rename from include/boost/test/fwd_decl.hpp rename to include/boost/test/detail/fwd_decl.hpp index 1a570800..049d6a48 100644 --- a/include/boost/test/fwd_decl.hpp +++ b/include/boost/test/detail/fwd_decl.hpp @@ -18,14 +18,25 @@ namespace boost { class execution_monitor; +class execution_exception; namespace unit_test { +class test_unit; class test_case; +class test_suite; + +class test_tree_visitor; +class test_observer; + +// singletons +class unit_test_monitor_t; +class unit_test_log_t; + class unit_test_log_formatter; struct log_entry_data; struct log_checkpoint_data; -class unit_test_log_t; + } // namespace unit_test @@ -35,23 +46,8 @@ class unit_test_log_t; // Revision History : // // $Log$ -// Revision 1.3 2005/02/01 08:59:28 rogeeff -// supplied_log_formatters split -// change formatters interface to simplify result interface -// -// Revision 1.2 2005/02/01 06:40:06 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.1 2005/01/18 08:27:30 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** diff --git a/include/boost/test/detail/global_typedef.hpp b/include/boost/test/detail/global_typedef.hpp new file mode 100644 index 00000000..7063f302 --- /dev/null +++ b/include/boost/test/detail/global_typedef.hpp @@ -0,0 +1,81 @@ +// (C) Copyright Gennadiy Rozental 2001-2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : some trivial global typedefs +// *************************************************************************** + +#ifndef BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER +#define BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER + +#include +#define BOOST_TEST_L( s ) boost::unit_test::literal_string( s, sizeof( s ) - 1 ) +#define BOOST_TEST_STRINGIZE( s ) BOOST_TEST_L( BOOST_STRINGIZE( s ) ) +#define BOOST_TEST_EMPTY_STRING BOOST_TEST_L( "" ) + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +typedef unsigned long counter_t; + +//____________________________________________________________________________// + +enum report_level { CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT, INV_REPORT_LEVEL }; + +//____________________________________________________________________________// + +enum output_format { CLF /* compiler log format */, XML /* XML */ }; + +//____________________________________________________________________________// + +enum test_unit_type { tut_case = 0x01, tut_suite = 0x10, tut_any = 0x11 }; + +//____________________________________________________________________________// + +typedef unsigned long test_unit_id; +const test_unit_id INV_TEST_UNIT_ID = 0xFFFFFFFF; +const test_unit_id MAX_TEST_CASE_ID = 0xFFFFFFFE; +const test_unit_id MIN_TEST_CASE_ID = 0x00010000; +const test_unit_id MAX_TEST_SUITE_ID = 0x0000FF00; +const test_unit_id MIN_TEST_SUITE_ID = 0x00000001; + +//____________________________________________________________________________// + +inline test_unit_type +test_id_2_unit_type( test_unit_id id ) +{ + return (id & 0xFFFF0000) != 0 ? tut_case : tut_suite; +} + +//____________________________________________________________________________// + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_GLOBAL_TYPEDEF_HPP_021005GER diff --git a/include/boost/test/detail/log_level.hpp b/include/boost/test/detail/log_level.hpp index a24ba131..5150e5b7 100644 --- a/include/boost/test/detail/log_level.hpp +++ b/include/boost/test/detail/log_level.hpp @@ -34,8 +34,7 @@ enum log_level { log_system_errors = 6, // including timeouts, signals, traps log_fatal_errors = 7, // including unit test macros or // fatal system errors - log_progress_only = 8, // only unit test progress to be reported - log_nothing = 9 + log_nothing = 8 }; } // namespace unit_test @@ -45,6 +44,9 @@ enum log_level { // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/01/18 08:27:30 rogeeff // unit_test_log rework: // eliminated need for ::instance() diff --git a/include/boost/test/detail/suppress_warnings.hpp b/include/boost/test/detail/suppress_warnings.hpp index 9ed498bf..b67f1106 100644 --- a/include/boost/test/detail/suppress_warnings.hpp +++ b/include/boost/test/detail/suppress_warnings.hpp @@ -18,12 +18,17 @@ # pragma warning(disable: 4512) // assignment operator could not be generated # pragma warning(disable: 4100) // unreferenced formal parameter # pragma warning(disable: 4996) // was declared deprecated +# pragma warning(disable: 4355) // 'this' : used in base member initializer list +# pragma warning(disable: 4706) // assignment within conditional expression #endif // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/detail/unit_test_parameters.hpp b/include/boost/test/detail/unit_test_parameters.hpp index a0502751..b0b2dcfa 100644 --- a/include/boost/test/detail/unit_test_parameters.hpp +++ b/include/boost/test/detail/unit_test_parameters.hpp @@ -12,52 +12,57 @@ // Description : storage for unit test framework parameters information // *************************************************************************** -#ifndef BOOST_UNIT_TEST_PARAMETERS_HPP_071894GER -#define BOOST_UNIT_TEST_PARAMETERS_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER -#include +#include +#include + +#include + +//____________________________________________________________________________// namespace boost { namespace unit_test { -// framework parameters and there corresponding command-line arguments -static literal_string LOG_LEVEL = "BOOST_TEST_LOG_LEVEL"; // --log_level -static literal_string NO_RESULT_CODE = "BOOST_TEST_RESULT_CODE"; // --result_code -static literal_string REPORT_LEVEL = "BOOST_TEST_REPORT_LEVEL"; // --report_level -static literal_string TESTS_TO_RUN = "BOOST_TESTS_TO_RUN"; // --run_test -static literal_string SAVE_TEST_PATTERN = "BOOST_TEST_SAVE_PATTERN"; // --save_pattern -static literal_string BUILD_INFO = "BOOST_TEST_BUILD_INFO"; // --build_info -static literal_string CATCH_SYS_ERRORS = "BOOST_TEST_CATCH_SYSTEM_ERRORS"; // --catch_system_errors -static literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT"; // --report_format -static literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT"; // --log_format -static literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT"; // --output_format -static literal_string DETECT_MEM_LEAKS = "BOOST_TEST_DETECT_MEMORY_LEAKS"; // --detect_memory_leaks +// ************************************************************************** // +// ************** runtime_config ************** // +// ************************************************************************** // -enum report_level { CONFIRMATION_REPORT, SHORT_REPORT, DETAILED_REPORT, NO_REPORT, UNDEF_REPORT }; -static literal_string report_level_names[] = { "confirm" , "short" , "detailed" , "no" }; +namespace runtime_config { -enum output_format { HRF /* human readable format */, XML /* XML */ }; +void init( int* argc, char** argv ); -const_string retrieve_framework_parameter( const_string parameter_name_, int* argc_, char** argv_ ); +unit_test::log_level log_level(); +bool no_result_code(); +unit_test::report_level report_level(); +const_string test_to_run(); +bool save_pattern(); +bool show_build_info(); +bool show_progress(); +bool catch_sys_errors(); +output_format report_format(); +output_format log_format(); +bool detect_memory_leaks(); + +} // namespace runtime_config } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.18 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.17 2005/01/31 05:59:36 rogeeff -// detect_memory_leaks feature added +// Revision 1.19 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_CONFIG_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_HPP_071894GER diff --git a/include/boost/test/detail/workaround.hpp b/include/boost/test/detail/workaround.hpp new file mode 100644 index 00000000..0c4a6439 --- /dev/null +++ b/include/boost/test/detail/workaround.hpp @@ -0,0 +1,70 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : contains mics. workarounds +// *************************************************************************** + +#ifndef BOOST_TEST_WORKAROUND_HPP_021005GER +#define BOOST_TEST_WORKAROUND_HPP_021005GER + +// Boost +#include // compilers workarounds and std::ptrdiff_t + +// STL +#include // for std::distance + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace ut_detail { + +#ifdef BOOST_NO_STD_DISTANCE +template +std::ptrdiff_t distance( T const& x_, T const& y_ ) +{ + std::ptrdiff_t res = 0; + + std::distance( x_, y_, res ); + + return res; +} +#else +using std::distance; +#endif + +} // namespace ut_detail + +} // namespace unit_test + +namespace unit_test_framework = unit_test; +namespace test_toolbox = test_tools; + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_WORKAROUND_HPP_021005GER diff --git a/include/boost/test/execution_monitor.hpp b/include/boost/test/execution_monitor.hpp index 0a6149f5..95661dc7 100644 --- a/include/boost/test/execution_monitor.hpp +++ b/include/boost/test/execution_monitor.hpp @@ -29,18 +29,23 @@ // design presented here. // *************************************************************************** -#ifndef BOOST_EXECUTION_MONITOR_HPP_071894GER -#define BOOST_EXECUTION_MONITOR_HPP_071894GER +#ifndef BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER +#define BOOST_TEST_EXECUTION_MONITOR_HPP_071894GER // Boost.Test -#include -#include +#include +#include +#include // Boost #include #include #include +#include + +//____________________________________________________________________________// + namespace boost { namespace detail { @@ -60,7 +65,7 @@ public: // Destructor virtual ~translate_exception_base() {} - virtual int operator()( boost::execution_monitor& mon ) = 0; + virtual int operator()( unit_test::callback0 const& F ) = 0; protected: // Data members @@ -126,10 +131,7 @@ private: class execution_monitor { public: - // Destructor - virtual ~execution_monitor() {} - - int execute( bool catch_system_errors = true, int timeout_ = 0 ); // timeout is in seconds + int execute( unit_test::callback0 const& F, bool catch_system_errors = true, int timeout = 0 ); // The catch_system_errors parameter specifies whether the monitor should // try to catch system errors/exceptions that would cause program to crash // in regular case @@ -138,28 +140,24 @@ public: // // Returns: Value returned by function(). // - // Effects: Calls run_function() inside a try/catch block which also may + // Effects: Calls executes supplied function F inside a try/catch block which also may // include other unspecified platform dependent error detection code. // // Throws: execution_exception on an uncaught C++ exception, // a hardware or software signal, trap, or other exception. // - // Note: execute() doesn't consider it an error for function() to - // return a non-zero value. + // Note: execute() doesn't consider it an error for F to return a non-zero value. - virtual int function() = 0; - // user supplied function called by run_function() - - int run_function(); - // call function() and translate user exceptions with translators registered - + // register custom (user supplied) exception translator template void register_exception_translator( ExceptionTranslator const& tr, boost::type* = 0 ); private: + // implementation helpers + int catch_signals( unit_test::callback0 const& F, bool catch_system_errors, int timeout ); + // Data members boost::scoped_ptr m_custom_translators; - }; // execution_monitor namespace detail { @@ -176,13 +174,11 @@ public: explicit translate_exception( ExceptionTranslator const& tr, base_ptr& next ) : translate_exception_base( next ), m_translator( tr ) {} - virtual int operator()( boost::execution_monitor& mon ) + int operator()( unit_test::callback0 const& F ) { try { - return m_next ? (*m_next)( mon ) : mon.function(); - } - catch( Exception const& e ) - { + return m_next ? (*m_next)( F ) : F(); + } catch( Exception const& e ) { m_translator( e ); return boost::exit_exception_failure; } @@ -210,12 +206,25 @@ execution_monitor::register_exception_translator( ExceptionTranslator const& tr, // turn on system memory leak detection void detect_memory_leaks(); +// ************************************************************************** // +// ************** execution_aborted ************** // +// ************************************************************************** // + +struct execution_aborted {}; + } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.22 2005/02/20 08:27:05 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.21 2005/02/01 08:59:28 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/floating_point_comparison.hpp b/include/boost/test/floating_point_comparison.hpp index beb3f850..11716cc8 100644 --- a/include/boost/test/floating_point_comparison.hpp +++ b/include/boost/test/floating_point_comparison.hpp @@ -12,13 +12,17 @@ // Description : defines algoirthms for comparing 2 floating point values // *************************************************************************** -#ifndef BOOST_FLOATING_POINT_COMPARISON_HPP_071894GER -#define BOOST_FLOATING_POINT_COMPARISON_HPP_071894GER +#ifndef BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER +#define BOOST_TEST_FLOATING_POINT_COMPARISON_HPP_071894GER #include // for std::numeric_limits #include +#include + +//____________________________________________________________________________// + namespace boost { namespace test_tools { @@ -117,10 +121,17 @@ compute_tolerance( FPT percentage_tolerance ) } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.21 2005/02/20 08:27:05 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.20 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/framework.hpp b/include/boost/test/framework.hpp new file mode 100644 index 00000000..e8f2f2a2 --- /dev/null +++ b/include/boost/test/framework.hpp @@ -0,0 +1,86 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines framework singletom object +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_HPP_020805GER +#define BOOST_TEST_FRAMEWORK_HPP_020805GER + +// Boost.Test +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** framework ************** // +// ************************************************************************** // + +namespace framework { + +// initialization +void init( int argc, char* argv[] ); + +// mutation access methods +void register_test_unit( test_case* tc ); +void register_test_unit( test_suite* ts ); + +void register_observer( test_observer& ); +void reset_observers(); + +// constant access methods +test_suite const& master_test_suite(); +test_case const& current_test_case(); +test_unit const& get( test_unit_id, test_unit_type ); +template +UnitType const& get( test_unit_id id ) +{ + return static_cast( get( id, (test_unit_type)UnitType::type ) ); +} + +// test initiation +void run( test_unit_id = INV_TEST_UNIT_ID, bool continue_test = true ); +void run( test_unit const*, bool continue_test = true ); + +// public test events dispatchers +void assertion_result( bool passed ); +void exception_caught( execution_exception const& ); +void test_unit_aborted(); + +} // namespace framework + +} // unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:05 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_FRAMEWORK_HPP_020805GER + diff --git a/include/boost/test/impl/compiler_log_formatter.ipp b/include/boost/test/impl/compiler_log_formatter.ipp index e8f9b6cd..24f91dfd 100644 --- a/include/boost/test/impl/compiler_log_formatter.ipp +++ b/include/boost/test/impl/compiler_log_formatter.ipp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -9,7 +9,7 @@ // // Version : $Revision$ // -// Description : implements compiler like log formatter +// Description : implements compiler like Log formatter // *************************************************************************** #ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_IPP_020105GER @@ -18,6 +18,8 @@ // Boost.Test #include #include +#include +#include // Boost #include @@ -25,6 +27,10 @@ // STL #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -36,86 +42,88 @@ namespace output { // ************************************************************************** // void -compiler_log_formatter::start_log( std::ostream& output, bool log_build_info ) +compiler_log_formatter::log_start( std::ostream& output, counter_t test_cases_amount ) { - if( log_build_info ) - output << "Platform: " << BOOST_PLATFORM << '\n' - << "Compiler: " << BOOST_COMPILER << '\n' - << "STL : " << BOOST_STDLIB << '\n' - << "Boost : " << BOOST_VERSION/100000 << "." - << BOOST_VERSION/100 % 1000 << "." - << BOOST_VERSION % 100 << '\n'; + if( test_cases_amount > 0 ) + output << "Running " << test_cases_amount << " test " + << (test_cases_amount > 1 ? "cases" : "case") << "...\n"; } //____________________________________________________________________________// void -compiler_log_formatter::log_header( std::ostream& output, counter_t test_cases_amount ) +compiler_log_formatter::log_finish( std::ostream& ) { - output << "Running " << test_cases_amount << " test " - << (test_cases_amount > 1 ? "cases" : "case") << "...\n"; + // do nothing } //____________________________________________________________________________// void -compiler_log_formatter::finish_log( std::ostream& /* output */ ) +compiler_log_formatter::log_build_info( std::ostream& output ) { + output << "Platform: " << BOOST_PLATFORM << '\n' + << "Compiler: " << BOOST_COMPILER << '\n' + << "STL : " << BOOST_STDLIB << '\n' + << "Boost : " << BOOST_VERSION/100000 << "." + << BOOST_VERSION/100 % 1000 << "." + << BOOST_VERSION % 100 << std::endl; } //____________________________________________________________________________// void -compiler_log_formatter::start_test_case( test_case const& tc ) +compiler_log_formatter::test_unit_start( std::ostream& output, test_unit const& tu ) { - m_curr_test_case_name = tc.p_name; + output << "Entering test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; } //____________________________________________________________________________// void -compiler_log_formatter::test_case_enter( std::ostream& output, test_case const& tc ) +compiler_log_formatter::test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed ) { - output << "Entering test " << ( tc.p_type ? "case" : "suite" ) << " \"" << m_curr_test_case_name << "\""; -} + output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\""; -//____________________________________________________________________________// - -void -compiler_log_formatter::test_case_exit( std::ostream& output, test_case const& tc, long testing_time_in_mks ) -{ - output << "Leaving test " << ( tc.p_type ? "case" : "suite" ) << " \"" << tc.p_name << "\""; - if( testing_time_in_mks > 0 ) { + if( elapsed > 0 ) { output << "; testing time: "; - if( testing_time_in_mks % 1000 == 0 ) - output << testing_time_in_mks/1000 << "ms"; + if( elapsed % 1000 == 0 ) + output << elapsed/1000 << "ms"; else - output << testing_time_in_mks << "mks"; + output << elapsed << "mks"; } - // we should've probably restored m_curr_test_case_name here, - // but we will reset it anyway next time in test_case_enter + output << std::endl; } //____________________________________________________________________________// void -compiler_log_formatter::log_exception( std::ostream& output, log_checkpoint_data const& checkpoint_data, - const_string explanation ) +compiler_log_formatter::test_unit_skipped( std::ostream& output, test_unit const& tu ) { - output << "Exception in \"" << m_curr_test_case_name << "\": " << explanation; + output << "Test " << tu.p_type_name << " \"" << tu.p_name << "\"" << "is skipped" << std::endl; +} + +//____________________________________________________________________________// + +void +compiler_log_formatter::log_exception( std::ostream& output, log_checkpoint_data const& checkpoint_data, const_string explanation ) +{ + output << "Exception in \"" << framework::current_test_case().p_name << "\": " << explanation; if( !checkpoint_data.m_message.empty() ) { output << '\n'; print_prefix( output, checkpoint_data.m_file, checkpoint_data.m_line ); output << "last checkpoint: " << checkpoint_data.m_message; } + + output << std::endl; } //____________________________________________________________________________// void -compiler_log_formatter::begin_log_entry( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) +compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) { switch( let ) { case BOOST_UTL_ET_INFO: @@ -126,15 +134,15 @@ compiler_log_formatter::begin_log_entry( std::ostream& output, log_entry_data co break; case BOOST_UTL_ET_WARNING: print_prefix( output, entry_data.m_file, entry_data.m_line ); - output << "warning in \"" << m_curr_test_case_name << "\": "; + output << "warning in \"" << framework::current_test_case().p_name << "\": "; break; case BOOST_UTL_ET_ERROR: print_prefix( output, entry_data.m_file, entry_data.m_line ); - output << "error in \"" << m_curr_test_case_name << "\": "; + output << "error in \"" << framework::current_test_case().p_name << "\": "; break; case BOOST_UTL_ET_FATAL_ERROR: print_prefix( output, entry_data.m_file, entry_data.m_line ); - output << "fatal error in \"" << m_curr_test_case_name << "\": "; + output << "fatal error in \"" << framework::current_test_case().p_name << "\": "; break; } } @@ -150,8 +158,9 @@ compiler_log_formatter::log_entry_value( std::ostream& output, const_string valu //____________________________________________________________________________// void -compiler_log_formatter::end_log_entry( std::ostream& /* output */ ) +compiler_log_formatter::log_entry_finish( std::ostream& output ) { + output << std::endl; } //____________________________________________________________________________// @@ -170,10 +179,17 @@ compiler_log_formatter::print_prefix( std::ostream& output, const_string file, s } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/02/01 08:59:38 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/impl/cpp_main.ipp b/include/boost/test/impl/cpp_main.ipp index 3804b422..a4450c15 100644 --- a/include/boost/test/impl/cpp_main.ipp +++ b/include/boost/test/impl/cpp_main.ipp @@ -13,44 +13,48 @@ // Description : main function implementation for Program Executon Monitor // *************************************************************************** -#ifndef BOOST_CPP_MAIN_IPP_012205GER -#define BOOST_CPP_MAIN_IPP_012205GER +#ifndef BOOST_TEST_CPP_MAIN_IPP_012205GER +#define BOOST_TEST_CPP_MAIN_IPP_012205GER // Boost.Test #include -#include +#include +#include // Boost -#include -#include +#include // for exit codes +#include // for workarounds // STL #include -#include +#include // std::getenv #include +#include + +//____________________________________________________________________________// + #ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::getenv; using ::strcmp; } +namespace std { using ::getenv; } #endif int cpp_main( int argc, char* argv[] ); // prototype for user's cpp_main() namespace { -class cpp_main_caller : public boost::execution_monitor { -public: - cpp_main_caller( int argc, char** argv ) - : m_argc( argc ), m_argv( argv ) {} - - int function() { return cpp_main( m_argc, m_argv ); } +struct cpp_main_caller { + cpp_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} + int operator()() { return cpp_main( m_argc, m_argv ); } + private: - int m_argc; - char** m_argv; + // Data members + int m_argc; + char** m_argv; }; -} +} // local namespace // ************************************************************************** // // ************** cpp main ************** // @@ -58,29 +62,28 @@ private: int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) { - cpp_main_caller caller( argc, argv ); - int result; boost::unit_test::const_string p( std::getenv( "BOOST_TEST_CATCH_SYSTEM_ERRORS" ) ); bool catch_system_errors = p != "no"; try { - result = caller.execute( catch_system_errors ); + ::boost::execution_monitor ex_mon; + result = ex_mon.execute( ::boost::unit_test::callback0( cpp_main_caller( argc, argv ) ), catch_system_errors ); if( result == 0 ) - result = boost::exit_success; - else if( result != boost::exit_success ) { + result = ::boost::exit_success; + else if( result != ::boost::exit_success ) { std::cout << "\n**** error return code: " << result << std::endl; - result = boost::exit_failure; + result = ::boost::exit_failure; } } - catch( boost::execution_exception const& exex ) { + catch( ::boost::execution_exception const& exex ) { std::cout << "\n**** exception(" << exex.code() << "): " << exex.what() << std::endl; - result = boost::exit_exception_failure; + result = ::boost::exit_exception_failure; } - if( result != boost::exit_success ) { + if( result != ::boost::exit_success ) { std::cerr << "******** errors detected; see standard output for details ********" << std::endl; } else { @@ -88,7 +91,7 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) // like the clutter. Use an environment variable to avoid command // line argument modifications; for use in production programs // that's a no-no in some organizations. - boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) ); + ::boost::unit_test::const_string p( std::getenv( "BOOST_PRG_MON_CONFIRM" ) ); if( p != "no" ) { std::cerr << std::flush << "no errors detected" << std::endl; } @@ -99,10 +102,15 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) //____________________________________________________________________________// +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed @@ -120,4 +128,4 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) // // *************************************************************************** -#endif // BOOST_CPP_MAIN_IPP_012205GER +#endif // BOOST_TEST_CPP_MAIN_IPP_012205GER diff --git a/include/boost/test/impl/execution_monitor.ipp b/include/boost/test/impl/execution_monitor.ipp index eb3a2dc5..b751f173 100644 --- a/include/boost/test/impl/execution_monitor.ipp +++ b/include/boost/test/impl/execution_monitor.ipp @@ -21,10 +21,11 @@ // boost libraries. // *************************************************************************** -#ifndef BOOST_EXECUTION_MONITOR_IPP_012205GER -#define BOOST_EXECUTION_MONITOR_IPP_012205GER +#ifndef BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER +#define BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER // Boost.Test +#include #include // Boost @@ -85,21 +86,19 @@ namespace std { using ::strlen; using ::strncat; } #include +//____________________________________________________________________________// + namespace boost { namespace detail { using unit_test::const_string; -// boost::execution_monitor::execute() calls boost::detail::catch_signals() to -// execute user function with signals control // boost::execution_monitor::execute() calls boost::detail::report_error(...) to // report any caught exception and throw execution_exception const std::size_t REPORT_ERROR_BUFFER_SIZE = 512; -static int catch_signals( execution_monitor & exmon, bool catch_system_errors, int timeout ); // timeout is in seconds. 0 implies none. - static void report_error( execution_exception::error_code ec, const_string msg1, // first part of the message @@ -134,7 +133,7 @@ private: void BOOST_TEST_CALL_DECL ms_se_trans_func( unsigned int id, _EXCEPTION_POINTERS* exps ); void BOOST_TEST_CALL_DECL ms_se_forward_func( unsigned int id, _EXCEPTION_POINTERS* exps ); -static void report_ms_se_error( unsigned int id ); +static void report_ms_se_error( unsigned int id ); //____________________________________________________________________________// @@ -192,15 +191,7 @@ assert_reporting_function( int reportType, char* userMessage, int* retVal ) // ************************************************************************** // int -execution_monitor::run_function() -{ - return m_custom_translators ? (*m_custom_translators)( *this ) : function(); -} - -//____________________________________________________________________________// - -int -execution_monitor::execute( bool catch_system_errors, int timeout ) +execution_monitor::execute( unit_test::callback0 const& F, bool catch_system_errors, int timeout ) { using unit_test::const_string; @@ -220,7 +211,7 @@ execution_monitor::execute( bool catch_system_errors, int timeout ) #endif try { - return detail::catch_signals( *this, catch_system_errors, timeout ); + return catch_signals( F, catch_system_errors, timeout ); } // Catch-clause reference arguments are a bit different from function @@ -228,10 +219,12 @@ execution_monitor::execute( bool catch_system_errors, int timeout ) // required. Programmers ask for const anyhow, so we supply it. That's // easier than answering questions about non-const usage. + catch( execution_aborted const& ) + { return 0; } catch( char const* ex ) { detail::report_error( execution_exception::cpp_exception_error, "C string: ", ex ); } catch( std::string const& ex ) - { detail::report_error( execution_exception::cpp_exception_error, "std::string: ", ex.c_str() ); } + { detail::report_error( execution_exception::cpp_exception_error, "std::string: ", ex.c_str() ); } // std:: exceptions @@ -291,14 +284,14 @@ execution_monitor::execute( bool catch_system_errors, int timeout ) //____________________________________________________________________________// -namespace detail { - #if defined(BOOST_SIGACTION_BASED_SIGNAL_HANDLING) // ************************************************************************** // // ************** boost::detail::signal_handler ************** // // ************************************************************************** // +namespace detail { + class signal_handler { public: // Constructor @@ -402,20 +395,26 @@ signal_handler::~signal_handler() //____________________________________________________________________________// +} // namespace detail + // ************************************************************************** // -// ************** boost::detail::catch_signals ************** // +// ************** execution_monitor::catch_signals ************** // // ************************************************************************** // -int catch_signals( execution_monitor & exmon, bool catch_system_errors, int timeout ) +int +execution_monitor::catch_signals( unit_test::callback0 const& F, bool catch_system_errors, int timeout ) { - signal_handler local_signal_handler( catch_system_errors, timeout ); - int result = 0; - execution_exception::error_code ec = execution_exception::no_error; - const_string em; + using namespace detail; + typedef execution_exception::error_code ec_type; - volatile int sigtype = sigsetjmp( signal_handler::jump_buffer(), 1 ); + signal_handler local_signal_handler( catch_system_errors, timeout ); + int result = 0; + ec_type ec = execution_exception::no_error; + const_string em; + + volatile int sigtype = sigsetjmp( signal_handler::jump_buffer(), 1 ); if( sigtype == 0 ) { - result = exmon.run_function(); + result = m_custom_translators ? (*m_custom_translators)( F ) : F(); } else { switch(sigtype) { @@ -446,9 +445,8 @@ int catch_signals( execution_monitor & exmon, bool catch_system_errors, int time } } - if( ec != execution_exception::no_error ) { + if( ec != execution_exception::no_error ) throw unix_signal_exception( ec, em ); - } return result; } // unix catch_signals @@ -458,29 +456,30 @@ int catch_signals( execution_monitor & exmon, bool catch_system_errors, int time #elif (defined(__BORLANDC__) && defined(_Windows) && !defined(BOOST_DISABLE_WIN32)) // this works for Borland but not other Win32 compilers (which trap too many cases) -int catch_signals( execution_monitor & exmon, bool catch_system_errors, int ) +int +execution_monitor::catch_signals( unit_test::callback0 const& F, bool catch_system_errors, int ) { int result; if( catch_system_errors ) { - __try { result = exmon.run_function(); } + __try { result = m_custom_translators ? (*m_custom_translators)( F ) : F(); } - __except (1) - { - throw ms_se_exception( GetExceptionCode() ); + __except (1) { + throw detail::ms_se_exception( GetExceptionCode() ); } } - else { - result = exmon.run_function(); - } + else + result = m_custom_translators ? (*m_custom_translators)( F ) : F(); + return result; } #else // default signal handler -int catch_signals( execution_monitor& exmon, bool, int ) +int +execution_monitor::catch_signals( unit_test::callback0 const& F, bool, int ) { - return exmon.run_function(); + return m_custom_translators ? (*m_custom_translators)( F ) : F(); } #endif // choose signal handler @@ -491,6 +490,8 @@ int catch_signals( execution_monitor& exmon, bool, int ) #if defined(BOOST_MS_STRCTURED_EXCEPTION_HANDLING) +namespace detail { + void BOOST_TEST_CALL_DECL ms_se_trans_func( unsigned int id, _EXCEPTION_POINTERS* /* exps */ ) { @@ -573,12 +574,16 @@ report_ms_se_error( unsigned int id ) //____________________________________________________________________________// +} // namespace detail + #endif // Microsoft structured exception handling // ************************************************************************** // // ************** report_error ************** // // ************************************************************************** // +namespace detail { + static void report_error( execution_exception::error_code ec, const_string msg1, const_string msg2 ) { static char buf[REPORT_ERROR_BUFFER_SIZE]; @@ -609,14 +614,19 @@ detect_memory_leaks() #endif // BOOST_MS_CRT_DEBUG_HOOKS } +} // namespace boost + //____________________________________________________________________________// -} // namespace boost +#include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed @@ -637,4 +647,4 @@ detect_memory_leaks() // // *************************************************************************** -#endif // BOOST_EXECUTION_MONITOR_IPP_012205GER +#endif // BOOST_TEST_EXECUTION_MONITOR_IPP_012205GER diff --git a/include/boost/test/impl/framework.ipp b/include/boost/test/impl/framework.ipp new file mode 100644 index 00000000..a1079ff8 --- /dev/null +++ b/include/boost/test/impl/framework.ipp @@ -0,0 +1,373 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements framework songleton - main driver for the test +// *************************************************************************** + +#ifndef BOOST_TEST_FRAMEWORK_IPP_021005GER +#define BOOST_TEST_FRAMEWORK_IPP_021005GER + +// Boost.Test +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +// Boost +#include + +// STL +#include +#include + +#include + +//____________________________________________________________________________// + +// prototype for user's test suite init function +extern boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ); + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** framework ************** // +// ************************************************************************** // + +class framework_impl : public test_tree_visitor { +public: + framework_impl() + : m_master_test_suite( INV_TEST_UNIT_ID ) + , m_curr_test_case( INV_TEST_UNIT_ID ) + , m_next_test_case_id( MIN_TEST_CASE_ID ) + , m_next_test_suite_id( MIN_TEST_SUITE_ID ) + , m_test_in_progress( false ) + {} + + ~framework_impl() + { + BOOST_TEST_FOREACH( test_unit_store::value_type const&, tu, m_test_units ) { + if( test_id_2_unit_type( tu.second->p_id ) == tut_suite ) + delete (test_suite const*)tu.second; + else + delete (test_case const*)tu.second; + } + } + + void set_tu_id( test_unit& tu, test_unit_id id ) { tu.p_id.value = id; } + + // test_tree_visitor interface implementation + void visit( test_case const& tc ) + { + if( !tc.check_dependencies() ) { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_skipped( tc ); + + return; + } + + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_start( tc ); + + boost::timer tc_timer; + test_unit_id bkup = m_curr_test_case; + m_curr_test_case = tc.p_id; + unit_test_monitor_t::error_level run_result = unit_test_monitor.execute_and_translate( tc ); + + unsigned long elapsed = static_cast( tc_timer.elapsed() * 1e6 ); + + if( unit_test_monitor.is_critical_error( run_result ) ) { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_aborted(); + } + + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_finish( tc, elapsed ); + + m_curr_test_case = bkup; + + if( unit_test_monitor.is_critical_error( run_result ) ) + throw test_aborted(); + } + + bool test_suite_start( test_suite const& ts ) + { + if( !ts.check_dependencies() ) { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_skipped( ts ); + + return false; + } + + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_start( ts ); + + return true; + } + + void test_suite_finish( test_suite const& ts ) + { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_finish( ts, 0 ); + } + + ////////////////////////////////////////////////////////////////// + + typedef std::map test_unit_store; + typedef std::list observer_store; + + test_unit_id m_master_test_suite; + test_unit_id m_curr_test_case; + test_unit_store m_test_units; + + test_unit_id m_next_test_case_id; + test_unit_id m_next_test_suite_id; + + bool m_test_in_progress; + + observer_store m_observers; + +}; + +//____________________________________________________________________________// + +namespace { + +framework_impl& s_frk_impl() { static framework_impl the_inst; return the_inst; } + +} // local namespace + +//____________________________________________________________________________// + +namespace framework { + +void +init( int argc, char* argv[] ) +{ + runtime_config::init( &argc, argv ); + + // set the log level nad format + unit_test_log.set_threshold_level( runtime_config::log_level() ); + unit_test_log.set_format( runtime_config::log_format() ); + + // set the report level nad format + results_reporter::set_level( runtime_config::report_level() ); + results_reporter::set_format( runtime_config::report_format() ); + + register_observer( results_collector ); + register_observer( unit_test_log ); + + if( runtime_config::show_progress() ) + register_observer( progress_monitor ); + + if( runtime_config::detect_memory_leaks() ) + boost::detect_memory_leaks(); + + // init master unit test suite + test_suite const* master_suite = init_unit_test_suite( argc, argv ); + if( !master_suite ) + throw std::logic_error( "Fail to initialize test suite" ); + + s_frk_impl().m_master_test_suite = master_suite->p_id; +} + +//____________________________________________________________________________// + +void +register_test_unit( test_case* tc ) +{ + if( tc->p_id != INV_TEST_UNIT_ID ) + throw std::logic_error( "Test case already registered" ); + + test_unit_id new_id = s_frk_impl().m_next_test_case_id; + + if( new_id == MAX_TEST_CASE_ID ) + throw std::logic_error( "Too many test cases" ); + + s_frk_impl().m_test_units.insert( std::make_pair( new_id, tc ) ); + s_frk_impl().m_next_test_case_id++; + + s_frk_impl().set_tu_id( *tc, new_id ); +} + +//____________________________________________________________________________// + +void +register_test_unit( test_suite* ts ) +{ + if( ts->p_id != INV_TEST_UNIT_ID ) + throw std::logic_error( "Test suite already registered" ); + + test_unit_id new_id = s_frk_impl().m_next_test_suite_id; + + if( new_id == MAX_TEST_SUITE_ID ) + throw std::logic_error( "Too many test suites" ); + + s_frk_impl().m_test_units.insert( std::make_pair( new_id, ts ) ); + s_frk_impl().m_next_test_suite_id++; + + s_frk_impl().set_tu_id( *ts, new_id ); +} + +//____________________________________________________________________________// + +void +register_observer( test_observer& to ) +{ + s_frk_impl().m_observers.push_back( &to ); +} + +//____________________________________________________________________________// + +void +reset_observers() +{ + s_frk_impl().m_observers.clear(); +} + +//____________________________________________________________________________// + +test_suite const& +master_test_suite() +{ + return get( s_frk_impl().m_master_test_suite ); +} + +//____________________________________________________________________________// + +test_case const& +current_test_case() +{ + return get( s_frk_impl().m_curr_test_case ); +} + +//____________________________________________________________________________// + +test_unit const& +get( test_unit_id id, test_unit_type t ) +{ + test_unit const* res = s_frk_impl().m_test_units[id]; + + if( (res->p_type & t) == 0 ) + throw std::logic_error( "Invalid test unit type" ); + + return *res; +} + +//____________________________________________________________________________// + +void +run( test_unit_id id, bool continue_test ) +{ + if( id == INV_TEST_UNIT_ID ) + id = s_frk_impl().m_master_test_suite; + + if( id == INV_TEST_UNIT_ID ) + throw std::logic_error( "Test unit is initialized" ); + + test_case_counter tcc; + traverse_test_tree( id, tcc ); + + bool call_start_finish = !continue_test || !s_frk_impl().m_test_in_progress; + bool was_in_progress = s_frk_impl().m_test_in_progress; + + s_frk_impl().m_test_in_progress = true; + + if( call_start_finish ) { + BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) + to->test_start( tcc.m_count ); + } + + + try { + traverse_test_tree( id, s_frk_impl() ); + } + catch( test_aborted const& ) { + // abort already reported + } + + if( call_start_finish ) { + BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) + to->test_finish(); + } + + s_frk_impl().m_test_in_progress = was_in_progress; +} + +//____________________________________________________________________________// + +void +run( test_unit const* tu, bool continue_test ) +{ + run( tu->p_id, continue_test ); +} + +//____________________________________________________________________________// + +void +assertion_result( bool passed ) +{ + BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) + to->assertion_result( passed ); +} + +//____________________________________________________________________________// + +void +exception_caught( execution_exception const& ex ) +{ + BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) + to->exception_caught( ex ); +} + +//____________________________________________________________________________// + +void +test_unit_aborted() +{ + test_unit const& tu = current_test_case(); + + BOOST_TEST_FOREACH( test_observer*, to, s_frk_impl().m_observers ) + to->test_unit_aborted( tu ); +} + +//____________________________________________________________________________// + +} // namespace framework + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_FRAMEWORK_IPP_021005GER diff --git a/include/boost/test/impl/plain_report_formatter.ipp b/include/boost/test/impl/plain_report_formatter.ipp new file mode 100644 index 00000000..3571d27c --- /dev/null +++ b/include/boost/test/impl/plain_report_formatter.ipp @@ -0,0 +1,203 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : plain report formatter definition +// *************************************************************************** + +#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER +#define BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER + +// Boost.Test +#include +#include +#include +#include + +#include + +// STL +#include +#include + +#include + +# ifdef BOOST_NO_STDC_NAMESPACE +namespace std { using ::log10; } +# endif + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace output { + +namespace { + +typedef custom_manip quote; + +template +inline std::ostream& +operator<<( custom_printer const& p, T const& value ) +{ + *p << '"' << value << '"'; + + return *p; +} + +//____________________________________________________________________________// + +void +print_stat_value( std::ostream& ostr, counter_t v, counter_t indent, counter_t total, + const_string name, const_string res ) +{ + if( v > 0 ) { + ostr << std::setw( indent ) << "" + << v << ' ' << name << ( v != 1 ? "s" : "" ); + if( total > 0 ) + ostr << " out of " << total; + + ostr << ' ' << res << '\n'; + } +} + +//____________________________________________________________________________// + +} // local namespace + +// ************************************************************************** // +// ************** plain_report_formatter ************** // +// ************************************************************************** // + +void +plain_report_formatter::results_report_start( std::ostream& ostr ) +{ + m_indent = 0; + ostr << '\n'; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::results_report_finish( std::ostream& ostr ) +{ + ostr.flush(); +} + +//____________________________________________________________________________// + +void +plain_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + const_string descr; + + if( tr.passed() ) + descr = "passed"; + else if( tr.p_skipped ) + descr = "skipped"; + else if( tr.p_aborted ) + descr = "aborted"; + else + descr = "failed"; + + ostr << std::setw( m_indent ) << "" + << "Test " << (tu.p_type == tut_case ? "case " : "suite " ) << quote() << tu.p_name << ' ' << descr; + + if( tr.p_skipped ) { + ostr << '\n'; + m_indent += 2; + return; + } + + counter_t total_assertions = tr.p_assertions_passed + tr.p_assertions_failed; + counter_t total_tc = tr.p_test_cases_passed + tr.p_test_cases_failed + tr.p_test_cases_skipped; + + if( total_assertions > 0 || total_tc > 0 ) + ostr << " with:"; + + ostr << '\n'; + m_indent += 2; + + print_stat_value( ostr, tr.p_assertions_passed, m_indent, total_assertions, "assertion", "passed" ); + print_stat_value( ostr, tr.p_assertions_failed, m_indent, total_assertions, "assertion", "failed" ); + print_stat_value( ostr, tr.p_expected_failures, m_indent, 0 , "failure" , "expected" ); + print_stat_value( ostr, tr.p_test_cases_passed, m_indent, total_tc , "test case", "passed" ); + print_stat_value( ostr, tr.p_test_cases_failed, m_indent, total_tc , "test case", "failed" ); + print_stat_value( ostr, tr.p_test_cases_skipped, m_indent, total_tc , "test case", "skipped" ); + + ostr << '\n'; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::test_unit_report_finish( test_unit const&, std::ostream& ) +{ + m_indent -= 2; +} + +//____________________________________________________________________________// + +void +plain_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + if( tr.passed() ) { + ostr << "*** No errors detected\n"; + return; + } + + if( tr.p_skipped ) { + ostr << "*** Test " << tu.p_type_name << " skipped \n"; + return; + } + + if( tr.p_assertions_failed == 0 ) { + ostr << "*** errors detected in test " << tu.p_type_name << " " << quote() << tu.p_name + << "; see standard output for details\n"; + return; + } + + + ostr << "*** " << tr.p_assertions_failed << " failure" << ( tr.p_assertions_failed != 1 ? "s" : "" ) << " detected"; + + if( tr.p_expected_failures > 0 ) + ostr << " (" << tr.p_expected_failures << " failure" << ( tr.p_expected_failures != 1 ? "s" : "" ) << " expected)"; + + ostr << " in test " << tu.p_type_name << " " << quote() << tu.p_name << "\n"; +} + +//____________________________________________________________________________// + +} // namespace output + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_IPP_020105GER diff --git a/include/boost/test/impl/progress_monitor.ipp b/include/boost/test/impl/progress_monitor.ipp new file mode 100644 index 00000000..b11d7212 --- /dev/null +++ b/include/boost/test/impl/progress_monitor.ipp @@ -0,0 +1,117 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements simple text based progress monitor +// *************************************************************************** + +#ifndef BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER +#define BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER + +// Boost.Test +#include +#include + +// Boost +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** progress_monitor ************** // +// ************************************************************************** // + +namespace { + +struct progress_monitor_impl { + // Constructor + progress_monitor_impl() + : m_stream( &std::cout ) + {} + + std::ostream* m_stream; + scoped_ptr m_progress_display; +}; + +progress_monitor_impl& s_pm_impl() { static progress_monitor_impl the_inst; return the_inst; } + +} // local namespace + +//____________________________________________________________________________// + +void +progress_monitor_t::test_start( counter_t test_cases_amount ) +{ + s_pm_impl().m_progress_display.reset( new progress_display( test_cases_amount, *s_pm_impl().m_stream ) ); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_aborted() +{ + (*s_pm_impl().m_progress_display) += s_pm_impl().m_progress_display->count(); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_unit_finish( test_unit const& tu, unsigned long ) +{ + if( tu.p_type == tut_case ) + ++(*s_pm_impl().m_progress_display); +} + +//____________________________________________________________________________// + +void +progress_monitor_t::test_unit_skipped( test_unit const& tu ) +{ + test_case_counter tcc; + traverse_test_tree( tu, tcc ); + + (*s_pm_impl().m_progress_display) += tcc.m_count; +} + +//____________________________________________________________________________// + +void +progress_monitor_t::set_stream( std::ostream& ostr ) +{ + s_pm_impl().m_stream = &ostr; +} + +//____________________________________________________________________________// + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_PROGRESS_MONITOR_IPP_020105GER diff --git a/include/boost/test/impl/results_collector.ipp b/include/boost/test/impl/results_collector.ipp new file mode 100644 index 00000000..2df0c6cb --- /dev/null +++ b/include/boost/test/impl/results_collector.ipp @@ -0,0 +1,279 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : implements Unit Test results collecting facility. +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER +#define BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER + +// Boost.Test +#include +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** test_results ************** // +// ************************************************************************** // + +test_results::test_results() +{ + clear(); +} + +//____________________________________________________________________________// + +bool +test_results::passed() const +{ + return !p_skipped && + p_test_cases_failed == 0 && + p_assertions_failed <= p_expected_failures && + !p_aborted; +} + +//____________________________________________________________________________// + +int +test_results::result_code() const +{ + return passed() ? exit_success + : ( (p_assertions_failed > p_expected_failures || p_skipped ) + ? exit_test_failure + : exit_exception_failure ); +} + +//____________________________________________________________________________// + +void +test_results::operator+=( test_results const& tr ) +{ + p_assertions_passed.value += tr.p_assertions_passed; + p_assertions_failed.value += tr.p_assertions_failed; + p_test_cases_passed.value += tr.p_test_cases_passed; + p_test_cases_failed.value += tr.p_test_cases_failed; + p_test_cases_skipped.value += tr.p_test_cases_skipped; +} + +//____________________________________________________________________________// + +void +test_results::clear() +{ + p_assertions_passed.value = 0; + p_assertions_failed.value = 0; + p_expected_failures.value = 0; + p_test_cases_passed.value = 0; + p_test_cases_failed.value = 0; + p_test_cases_skipped.value = 0; + p_aborted.value = false; + p_skipped.value = true; +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** results_collector ************** // +// ************************************************************************** // + +namespace { + +struct results_collector_impl { + std::map m_results_store; +}; + +results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; } + +} // local namespace + +//____________________________________________________________________________// + +void +results_collector_t::test_start( counter_t ) +{ + s_rc_impl().m_results_store.clear(); +} + +//____________________________________________________________________________// + +void +results_collector_t::test_finish() +{ + // do nothing +} + +//____________________________________________________________________________// + +void +results_collector_t::test_aborted() +{ + // do nothing +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_start( test_unit const& tu ) +{ + // init test_results entry + test_results& tr = s_rc_impl().m_results_store[tu.p_id]; + + tr.clear(); + + tr.p_expected_failures.value = tu.p_expected_failures; + tr.p_skipped.value = false; +} + +//____________________________________________________________________________// + +class results_collect_helper : public test_tree_visitor { +public: + explicit results_collect_helper( test_results& tr, test_unit const& ts ) : m_tr( tr ), m_ts( ts ) {} + + void visit( test_case const& tc ) + { + test_results const& tr = results_collector.results( tc.p_id ); + m_tr += tr; + + if( tr.passed() ) + m_tr.p_test_cases_passed.value++; + else if( tr.p_skipped ) + m_tr.p_test_cases_skipped.value++; + else + m_tr.p_test_cases_failed.value++; + } + bool test_suite_start( test_suite const& ts ) + { + if( m_ts.p_id == ts.p_id ) + return true; + else { + m_tr += results_collector.results( ts.p_id ); + return false; + } + } + +private: + // Data members + test_results& m_tr; + test_unit const& m_ts; +}; + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_finish( test_unit const& tu, unsigned long ) +{ + if( tu.p_type == tut_suite ) { + results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu ); + + traverse_test_tree( tu, ch ); + } + else { + test_results const& tr = s_rc_impl().m_results_store[tu.p_id]; + + BOOST_WARN_MESSAGE( tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures, + "Test case has less failures then expected" ); + } +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_skipped( test_unit const& tu ) +{ + if( tu.p_type == tut_suite ) { + test_case_counter tcc; + traverse_test_tree( tu, tcc ); + + test_results& tr = s_rc_impl().m_results_store[tu.p_id]; + + tr.clear(); + + tr.p_skipped.value = true; + tr.p_test_cases_skipped.value = tcc.m_count; + } +} + +//____________________________________________________________________________// + +void +results_collector_t::assertion_result( bool passed ) +{ + test_results& tr = s_rc_impl().m_results_store[framework::current_test_case().p_id]; + + if( passed ) + tr.p_assertions_passed.value++; + else + tr.p_assertions_failed.value++; + + if( tr.p_assertions_failed == 1 ) + first_failed_assertion(); +} + +//____________________________________________________________________________// + +void +results_collector_t::exception_caught( execution_exception const& ) +{ + // do nothing +} + +//____________________________________________________________________________// + +void +results_collector_t::test_unit_aborted( test_unit const& tu ) +{ + s_rc_impl().m_results_store[tu.p_id].p_aborted.value = true; +} + +//____________________________________________________________________________// + +test_results const& +results_collector_t::results( test_unit_id id ) const +{ + return s_rc_impl().m_results_store[id]; +} + +//____________________________________________________________________________// + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_RESULTS_COLLECTOR_IPP_021105GER diff --git a/include/boost/test/impl/results_reporter.ipp b/include/boost/test/impl/results_reporter.ipp new file mode 100644 index 00000000..6e43ecf9 --- /dev/null +++ b/include/boost/test/impl/results_reporter.ipp @@ -0,0 +1,184 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : result reporting facilties +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_REPORTER_IPP_020105GER +#define BOOST_TEST_RESULTS_REPORTER_IPP_020105GER + +// Boost.Test +#include +#include +#include +#include +#include +#include + +// Boost +#include + +// STL +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace results_reporter { + +// ************************************************************************** // +// ************** result reporter implementation ************** // +// ************************************************************************** // + +namespace { + +struct results_reporter_impl : test_tree_visitor { + // Constructor + results_reporter_impl() + : m_output( &std::cout ) + , m_report_level( CONFIRMATION_REPORT ) + , m_formatter( new output::plain_report_formatter ) + {} + + // test tree visitor interface implementation + void visit( test_case const& tc ) + { + m_formatter->test_unit_report_start( tc, *m_output ); + m_formatter->test_unit_report_finish( tc, *m_output ); + } + bool test_suite_start( test_suite const& ts ) + { + m_formatter->test_unit_report_start( ts, *m_output ); + + if( m_report_level == DETAILED_REPORT && !results_collector.results( ts.p_id ).p_skipped ) + return true; + + m_formatter->test_unit_report_finish( ts, *m_output ); + return false; + } + void test_suite_finish( test_suite const& ts ) + { + m_formatter->test_unit_report_finish( ts, *m_output ); + } + + std::ostream* m_output; + report_level m_report_level; + scoped_ptr m_formatter; +}; + +results_reporter_impl& s_rr_impl() { static results_reporter_impl the_inst; return the_inst; } + +} // local namespace + +// ************************************************************************** // +// ************** report configuration ************** // +// ************************************************************************** // + +void +set_level( report_level l ) +{ + if( l != INV_REPORT_LEVEL ) + s_rr_impl().m_report_level = l; +} + +//____________________________________________________________________________// + +void +set_stream( std::ostream& ostr ) +{ + s_rr_impl().m_output = &ostr; +} + +//____________________________________________________________________________// + +void +set_format( output_format rf ) +{ + switch( rf ) { + case CLF: + s_rr_impl().m_formatter.reset( new output::plain_report_formatter ); + break; + case XML: + s_rr_impl().m_formatter.reset( new output::xml_report_formatter ); + break; + } +} + +//____________________________________________________________________________// + +void set_format( results_reporter::format* ) +{ +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** report initiation ************** // +// ************************************************************************** // + +void +make_report( report_level l, test_unit_id id ) +{ + if( l == INV_REPORT_LEVEL ) + l = s_rr_impl().m_report_level; + + if( l == NO_REPORT ) + return; + + if( id == INV_TEST_UNIT_ID ) + id = framework::master_test_suite().p_id; + + report_level bkup = s_rr_impl().m_report_level; + s_rr_impl().m_report_level = l; + + s_rr_impl().m_formatter->results_report_start( *s_rr_impl().m_output ); + + switch( l ) { + case CONFIRMATION_REPORT: + s_rr_impl().m_formatter->do_confirmation_report( framework::get( id ), *s_rr_impl().m_output ); + break; + case SHORT_REPORT: + case DETAILED_REPORT: + traverse_test_tree( id, s_rr_impl() ); + break; + } + + s_rr_impl().m_formatter->results_report_finish( *s_rr_impl().m_output ); + s_rr_impl().m_report_level = bkup; +} + +//____________________________________________________________________________// + +} // namespace results_reporter + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_RESULTS_REPORTER_IPP_020105GER diff --git a/include/boost/test/impl/test_main.ipp b/include/boost/test/impl/test_main.ipp index b68ce60d..96945431 100644 --- a/include/boost/test/impl/test_main.ipp +++ b/include/boost/test/impl/test_main.ipp @@ -13,127 +13,64 @@ // Description : implements main function for Test Execution Monitor. // *************************************************************************** -#ifndef BOOST_TEST_MAIN_IPP_012205GER -#define BOOST_TEST_MAIN_IPP_012205GER +#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER +#define BOOST_TEST_TEST_MAIN_IPP_012205GER // Boost.Test -#include // for unit test framework -#include -#include -#include -#include +#include +#include // Boost -#include +#include -// STL -#include // for cout, cerr +#include -int test_main( int argc, char* argv[] ); // prototype for user's test_main() +//____________________________________________________________________________// -namespace { - int argc_; - char** argv_; - int test_main_result; +extern int test_main( int argc, char* argv[] ); // prototype for user's test_main() - void call_test_main() - { - test_main_result = test_main( argc_, argv_ ); +struct test_main_caller { + test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {} + + void operator()() { + int test_main_result = test_main( m_argc, m_argv ); // translate a test_main non-success return into a test error BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success ); } -} + +private: + // Data members + int m_argc; + char** m_argv; +}; // ************************************************************************** // // ************** test main ************** // // ************************************************************************** // -int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) { - using namespace boost::unit_test; - - // set the log level - unit_test_log.set_threshold_level_by_name( retrieve_framework_parameter( LOG_LEVEL, &argc, argv ) ); - - // set the report level - const_string reportlevel = retrieve_framework_parameter( REPORT_LEVEL, &argc, argv ); - - // set the log/report format - const_string output_format = retrieve_framework_parameter( OUTPUT_FORMAT, &argc, argv ); - - if( output_format.empty() ) { - unit_test_log.set_format( retrieve_framework_parameter( LOG_FORMAT, &argc, argv ) ); - unit_test_result::set_report_format( retrieve_framework_parameter( REPORT_FORMAT, &argc, argv ) ); - } - else { - unit_test_log.set_format( output_format ); - unit_test_result::set_report_format( output_format ); - } - - // set the result code flag - bool no_result_code = retrieve_framework_parameter( NO_RESULT_CODE, &argc, argv ) == "no"; - - // set catch_system_error switch - ut_detail::unit_test_monitor::catch_system_errors( retrieve_framework_parameter( CATCH_SYS_ERRORS, &argc, argv ) != "no" ); - - // set up the test - argc_ = argc; - argv_ = argv; - boost::scoped_ptr test_main_tc( BOOST_TEST_CASE( &call_test_main ) ); - - // start testing - unit_test_log.start( retrieve_framework_parameter( BUILD_INFO, &argc, argv ) == "yes" ); - test_main_tc->run(); - unit_test_log.finish( 1 ); - - // report results - unit_test_result::instance().report( reportlevel, std::cout ); - - // return code - return no_result_code - ? boost::exit_success - : ( test_main_result != 0 && test_main_result != boost::exit_success - ? test_main_result - : unit_test_result::instance().result_code() - ); +::boost::unit_test::test_suite* +init_unit_test_suite( int argc, char* argv[] ) { + using namespace ::boost::unit_test; + + test_suite* test = BOOST_TEST_SUITE( "Test Program" ); + + test->add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) ); + + return test; } +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.5 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.4 2005/01/31 07:50:06 rogeeff -// cdecl portability fix -// -// Revision 1.3 2005/01/31 06:01:54 rogeeff -// BOOST_TEST_CALL_DECL correctness fixes -// -// Revision 1.2 2005/01/30 01:58:33 rogeeff -// include log explecetly -// -// Revision 1.1 2005/01/22 19:22:12 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory -// -// Revision 1.20 2005/01/19 16:34:06 vawjr -// Changed the \r\r\n back to \r\n on windows so we don't get errors when compiling -// on VC++8.0. I don't know why Microsoft thinks it's a good idea to call this an error, -// but they do. I also don't know why people insist on checking out files on Windows and -// copying them to a unix system to check them in (which will cause exactly this problem) -// -// Revision 1.19 2005/01/18 08:30:08 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// Revision 1.6 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_TEST_MAIN_IPP_012205GER +#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER diff --git a/include/boost/test/impl/test_tools.ipp b/include/boost/test/impl/test_tools.ipp index 57ffc428..cbd7dcfe 100644 --- a/include/boost/test/impl/test_tools.ipp +++ b/include/boost/test/impl/test_tools.ipp @@ -12,24 +12,23 @@ // Description : supplies offline implementation for the Test Tools // *************************************************************************** -#ifndef BOOST_TEST_TOOLS_IPP_012205GER -#define BOOST_TEST_TOOLS_IPP_012205GER +#ifndef BOOST_TEST_TEST_TOOLS_IPP_012205GER +#define BOOST_TEST_TEST_TOOLS_IPP_012205GER // Boost.Test #include -#include #include #include +#include +#include // execution_aborted // Boost #include // STL #include -#include -#include -#include #include +#include #include #include #ifdef BOOST_STANDARD_IOSTREAMS @@ -37,6 +36,10 @@ #endif #include +#include + +//____________________________________________________________________________// + # ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::strcmp; using ::strlen; using ::isprint; using ::va_list; } #if !defined( BOOST_NO_CWCHAR ) @@ -44,8 +47,6 @@ namespace std { using ::wcscmp; } #endif # endif -#include - namespace boost { namespace test_tools { @@ -71,12 +72,15 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, char const* prefix; char const* suffix; + if( tl == PASS ) + framework::assertion_result( true ); + else if( tl != WARN ) + framework::assertion_result( false ); + switch( tl ) { case PASS: - unit_test_result::instance().inc_passed_assertions(); - ll = log_successful_tests; - prefix = "test "; + prefix = "check "; suffix = " passed"; break; case WARN: @@ -85,15 +89,11 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, suffix = " is not satisfied"; break; case CHECK: - unit_test_result::instance().inc_failed_assertions(); - ll = log_all_errors; - prefix = "test "; + prefix = "check "; suffix = " failed"; break; case REQUIRE: - unit_test_result::instance().inc_failed_assertions(); - ll = log_fatal_errors; prefix = "critical test "; suffix = " failed"; @@ -113,8 +113,12 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, unit_test_log << log::end(); break; case CHECK_MSG: - unit_test_log << log::begin() << log::file( file_name ) << log::line( line_num ) - << ll << check_descr.str(); + unit_test_log << log::begin() << log::file( file_name ) << log::line( line_num ) << ll; + + if( tl == PASS ) + unit_test_log << prefix << "'" << check_descr.str() << "'" << suffix; + else + unit_test_log << check_descr.str(); if( !pr.has_empty_message() ) unit_test_log << ". " << pr.message(); @@ -126,8 +130,7 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, << log_messages << check_descr.str() << log::end(); break; case SET_CHECKPOINT: - unit_test_log << log::begin() << log::file( file_name ) << log::line( line_num ) - << log_test_suites << log::checkpoint( check_descr.str() ) << log::end(); + unit_test_log << log::file( file_name ) << log::line( line_num ) << log::checkpoint( check_descr.str() ); break; case CHECK_EQUAL: { std::va_list args; @@ -160,7 +163,7 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, char const* arg1_val = va_arg( args, char const* ); char const* arg2_descr = va_arg( args, char const* ); char const* arg2_val = va_arg( args, char const* ); - /* toler_descr = */ va_arg( args, char const* ); + /* toler_descr = */ va_arg( args, char const* ); char const* toler_val = va_arg( args, char const* ); unit_test_log << log::begin() << log::file( file_name ) << log::line( line_num ) << ll; @@ -264,8 +267,11 @@ check_impl( predicate_result const& pr, wrap_stringstream& check_descr, } } - if( tl == REQUIRE ) - throw test_tool_failed(); + if( tl == REQUIRE ) { + framework::test_unit_aborted(); + + throw execution_aborted(); + } } //____________________________________________________________________________// @@ -360,7 +366,7 @@ print_log_value::operator()( std::ostream& ostr, wchar_t const* struct output_test_stream::Impl { - std::fstream m_pattern_to_match_or_save; + std::fstream m_pattern; bool m_match_or_save; std::string m_synced_string; @@ -368,10 +374,8 @@ struct output_test_stream::Impl { char res; do { - m_pattern_to_match_or_save.get( res ); - } while( res == '\r' && - !m_pattern_to_match_or_save.fail() && - !m_pattern_to_match_or_save.eof() ); + m_pattern.get( res ); + } while( res == '\r' && !m_pattern.fail() && !m_pattern.eof() ); return res; } @@ -388,8 +392,13 @@ struct output_test_stream::Impl output_test_stream::output_test_stream( const_string pattern_file_name, bool match_or_save ) : m_pimpl( new Impl ) { - if( !pattern_file_name.is_empty() ) - m_pimpl->m_pattern_to_match_or_save.open( pattern_file_name.begin(), match_or_save ? std::ios::in : std::ios::out ); + if( !pattern_file_name.is_empty() ) { + m_pimpl->m_pattern.open( pattern_file_name.begin(), match_or_save ? std::ios::in : std::ios::out ); + + BOOST_WARN_MESSAGE( m_pimpl->m_pattern.is_open(), + "Couldn't open pattern file " << pattern_file_name + << " for " << ( m_pimpl->m_match_or_save ? "reading" : "writing") ); + } m_pimpl->m_match_or_save = match_or_save; } @@ -398,6 +407,7 @@ output_test_stream::output_test_stream( const_string pattern_file_name, bool mat output_test_stream::~output_test_stream() { + delete m_pimpl; } //____________________________________________________________________________// @@ -460,18 +470,17 @@ output_test_stream::match_pattern( bool flush_stream ) result_type result( true ); - if( !m_pimpl->m_pattern_to_match_or_save.is_open() ) { + if( !m_pimpl->m_pattern.is_open() ) { result = false; - result.message() << "Couldn't open pattern file for " - << ( m_pimpl->m_match_or_save ? "reading" : "writing"); + result.message() << "I/O failure"; } else { if( m_pimpl->m_match_or_save ) { for ( std::string::size_type i = 0; i < m_pimpl->m_synced_string.length(); ++i ) { char c = m_pimpl->get_char(); - result = !m_pimpl->m_pattern_to_match_or_save.fail() && - !m_pimpl->m_pattern_to_match_or_save.eof() && + result = !m_pimpl->m_pattern.fail() && + !m_pimpl->m_pattern.eof() && (m_pimpl->m_synced_string[i] == c); if( !result ) { @@ -487,8 +496,7 @@ output_test_stream::match_pattern( bool flush_stream ) while( --counter ) { char c = m_pimpl->get_char(); - if( m_pimpl->m_pattern_to_match_or_save.fail() || - m_pimpl->m_pattern_to_match_or_save.eof() ) + if( m_pimpl->m_pattern.fail() || m_pimpl->m_pattern.eof() ) break; result.message() << c; @@ -497,15 +505,15 @@ output_test_stream::match_pattern( bool flush_stream ) result.message() << "..."; // skip rest of the bytes. May help for further matching - m_pimpl->m_pattern_to_match_or_save.ignore( m_pimpl->m_synced_string.length() - i - suffix_size); + m_pimpl->m_pattern.ignore( m_pimpl->m_synced_string.length() - i - suffix_size ); break; } } } else { - m_pimpl->m_pattern_to_match_or_save.write( m_pimpl->m_synced_string.c_str(), - static_cast( m_pimpl->m_synced_string.length() ) ); - m_pimpl->m_pattern_to_match_or_save.flush(); + m_pimpl->m_pattern.write( m_pimpl->m_synced_string.c_str(), + static_cast( m_pimpl->m_synced_string.length() ) ); + m_pimpl->m_pattern.flush(); } } @@ -558,10 +566,17 @@ output_test_stream::sync() } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/02 12:08:14 rogeeff // namespace log added for log manipulators // @@ -590,4 +605,4 @@ output_test_stream::sync() // // *************************************************************************** -#endif // BOOST_TEST_TOOLS_IPP_012205GER +#endif // BOOST_TEST_TEST_TOOLS_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_log.ipp b/include/boost/test/impl/unit_test_log.ipp index b48f743e..fab269cd 100644 --- a/include/boost/test/impl/unit_test_log.ipp +++ b/include/boost/test/impl/unit_test_log.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,37 +9,34 @@ // // Version : $Revision$ // -// Description : implemets Unit Test Log, Majority of implementation details -// are hidden in this file with use of pimpl idiom. +// Description : implemets Unit Test Log // *************************************************************************** -#ifndef BOOST_UNIT_TEST_LOG_IPP_012205GER -#define BOOST_UNIT_TEST_LOG_IPP_012205GER +#ifndef BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER // Boost.Test #include #include -#include +#include +#include #include #include -#include #include #include // Boost #include -#include // STL -#include -#include +#include -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; } -# endif +#include + +//____________________________________________________________________________// namespace boost { @@ -91,21 +88,26 @@ entry_value_collector::~entry_value_collector() // ************** unit_test_log ************** // // ************************************************************************** // -namespace { +namespace { struct unit_test_log_impl { // Constructor - unit_test_log_impl() : m_stream( &std::cout ) {} + unit_test_log_impl() + : m_stream( &std::cout ) + , m_threshold_level( log_all_errors ) + , m_log_formatter( new output::compiler_log_formatter ) + { + } // log data + typedef scoped_ptr formatter_ptr; std::ostream* m_stream; log_level m_threshold_level; - boost::scoped_ptr m_progress_display; - boost::scoped_ptr m_log_formatter; + formatter_ptr m_log_formatter; // entry data bool m_entry_in_progress; - bool m_entry_has_value; + bool m_entry_started; log_entry_data m_entry_data; // checkpoint data @@ -113,131 +115,123 @@ struct unit_test_log_impl { // helper functions std::ostream& stream() { return *m_stream; } - void flush_entry() { stream() << std::endl; } - void clear_entry_data() - { - m_entry_data.clear(); - m_entry_in_progress = false; - m_entry_has_value = false; - } void set_checkpoint( log::checkpoint const& cp ) { cp.m_message.assign_to( m_checkpoint_data.m_message ); m_checkpoint_data.m_file = m_entry_data.m_file; m_checkpoint_data.m_line = m_entry_data.m_line; } - void clear_checkpoint() { m_checkpoint_data.clear(); } }; -unit_test_log_impl& s_impl() { static unit_test_log_impl the_inst; return the_inst; } +unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; } } // local namespace //____________________________________________________________________________// -unit_test_log_t::unit_test_log_t() +void +unit_test_log_t::test_start( counter_t test_cases_amount ) { - s_impl().m_threshold_level = log_all_errors; + s_log_impl().m_log_formatter->log_start( s_log_impl().stream(), test_cases_amount ); - s_impl().m_log_formatter.reset( new output::compiler_log_formatter ); + if( runtime_config::show_build_info() ) + s_log_impl().m_log_formatter->log_build_info( s_log_impl().stream() ); - s_impl().clear_entry_data(); - s_impl().clear_checkpoint(); -} - -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::instance() -{ - static unit_test_log_t the_instance; - - return the_instance; + s_log_impl().m_entry_in_progress = false; } //____________________________________________________________________________// void -unit_test_log_t::set_stream( std::ostream& str ) +unit_test_log_t::test_finish() { - if( s_impl().m_entry_in_progress ) - return; - - s_impl().m_stream = &str; + s_log_impl().m_log_formatter->log_finish( s_log_impl().stream() ); } //____________________________________________________________________________// void -unit_test_log_t::set_threshold_level( log_level lev ) +unit_test_log_t::test_aborted() { - if( s_impl().m_entry_in_progress || lev == invalid_log_level ) - return; - - s_impl().m_threshold_level = lev; + BOOST_UT_LOG_ENTRY( log_messages ) << "Test is aborted"; } //____________________________________________________________________________// void -unit_test_log_t::set_threshold_level_by_name( const_string lev ) +unit_test_log_t::test_unit_start( test_unit const& tu ) { - static fixed_mapping log_level_name( - "all" , log_successful_tests, - "success" , log_successful_tests, - "test_suite" , log_test_suites, - "messages" , log_messages, - "warnings" , log_warnings, - "all_errors" , log_all_errors, - "cpp_exceptions", log_cpp_exception_errors, - "system_errors" , log_system_errors, - "fatal_errors" , log_fatal_errors, - "progress" , log_progress_only, - "nothing" , log_nothing, - - invalid_log_level - ); - - if( s_impl().m_entry_in_progress ) + if( s_log_impl().m_threshold_level > log_test_suites ) return; - set_threshold_level( log_level_name[lev] ); + if( s_log_impl().m_entry_in_progress ) + *this << log::end(); + + s_log_impl().m_log_formatter->test_unit_start( s_log_impl().stream(), tu ); } //____________________________________________________________________________// void -unit_test_log_t::test_case_enter( test_case const& tc ) +unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed ) { - s_impl().m_log_formatter->start_test_case( tc ); - - if( s_impl().m_threshold_level > log_test_suites ) + if( s_log_impl().m_threshold_level > log_test_suites ) return; - *this << log::begin(); + s_log_impl().m_checkpoint_data.clear(); - s_impl().m_log_formatter->test_case_enter( s_impl().stream(), tc ); - s_impl().m_entry_has_value = true; + if( s_log_impl().m_entry_in_progress ) + *this << log::end(); - *this << log::end(); + s_log_impl().m_log_formatter->test_unit_finish( s_log_impl().stream(), tu, elapsed ); } //____________________________________________________________________________// void -unit_test_log_t::test_case_exit( test_case const& tc, long testing_time_in_mks ) +unit_test_log_t::test_unit_skipped( test_unit const& tu ) { - if( s_impl().m_threshold_level > log_test_suites ) + if( s_log_impl().m_threshold_level > log_test_suites ) return; - s_impl().clear_checkpoint(); + if( s_log_impl().m_entry_in_progress ) + *this << log::end(); - *this << log::begin(); + s_log_impl().m_log_formatter->test_unit_skipped( s_log_impl().stream(), tu ); +} - s_impl().m_log_formatter->test_case_exit( s_impl().stream(), tc, testing_time_in_mks ); - s_impl().m_entry_has_value = true; +//____________________________________________________________________________// - *this << log::end(); +void +unit_test_log_t::test_unit_aborted( test_unit const& ) +{ + // do nothing +} + +//____________________________________________________________________________// + +void +unit_test_log_t::assertion_result( bool ) +{ + // do nothing +} + +//____________________________________________________________________________// + +void +unit_test_log_t::exception_caught( execution_exception const& ex ) +{ + log_level l = + ex.code() <= execution_exception::cpp_exception_error ? log_cpp_exception_errors : + (ex.code() <= execution_exception::timeout_error ? log_system_errors + : log_fatal_errors ); + + if( l >= s_log_impl().m_threshold_level ) { + if( s_log_impl().m_entry_in_progress ) + *this << log::end(); + + s_log_impl().m_log_formatter->log_exception( s_log_impl().stream(), s_log_impl().m_checkpoint_data, ex.what() ); + } } //____________________________________________________________________________// @@ -245,10 +239,10 @@ unit_test_log_t::test_case_exit( test_case const& tc, long testing_time_in_mks ) unit_test_log_t& unit_test_log_t::operator<<( log::begin const& ) { - if( s_impl().m_entry_in_progress ) + if( s_log_impl().m_entry_in_progress ) *this << log::end(); - s_impl().m_entry_in_progress = true; + s_log_impl().m_entry_data.clear(); return *this; } @@ -258,12 +252,10 @@ unit_test_log_t::operator<<( log::begin const& ) unit_test_log_t& unit_test_log_t::operator<<( log::end const& ) { - if( s_impl().m_entry_has_value ) { - s_impl().m_log_formatter->end_log_entry( s_impl().stream() ); - s_impl().flush_entry(); - } + if( s_log_impl().m_entry_in_progress ) + s_log_impl().m_log_formatter->log_entry_finish( s_log_impl().stream() ); - s_impl().clear_entry_data(); + s_log_impl().m_entry_in_progress = false; return *this; } @@ -279,14 +271,12 @@ set_unix_slash( char in ) unit_test_log_t& unit_test_log_t::operator<<( log::file const& f ) { - if( s_impl().m_entry_in_progress ) { - f.m_file_name.assign_to( s_impl().m_entry_data.m_file ); + f.m_file_name.assign_to( s_log_impl().m_entry_data.m_file ); - // normalize file name - std::transform( s_impl().m_entry_data.m_file.begin(), s_impl().m_entry_data.m_file.end(), - s_impl().m_entry_data.m_file.begin(), - &set_unix_slash ); - } + // normalize file name + std::transform( s_log_impl().m_entry_data.m_file.begin(), s_log_impl().m_entry_data.m_file.end(), + s_log_impl().m_entry_data.m_file.begin(), + &set_unix_slash ); return *this; } @@ -296,8 +286,7 @@ unit_test_log_t::operator<<( log::file const& f ) unit_test_log_t& unit_test_log_t::operator<<( log::line const& l ) { - if( s_impl().m_entry_in_progress ) - s_impl().m_entry_data.m_line = l.m_line_num; + s_log_impl().m_entry_data.m_line = l.m_line_num; return *this; } @@ -307,8 +296,7 @@ unit_test_log_t::operator<<( log::line const& l ) unit_test_log_t& unit_test_log_t::operator<<( log::checkpoint const& cp ) { - if( s_impl().m_entry_in_progress ) - s_impl().set_checkpoint( cp ); + s_log_impl().set_checkpoint( cp ); return *this; } @@ -318,7 +306,7 @@ unit_test_log_t::operator<<( log::checkpoint const& cp ) unit_test_log_t& unit_test_log_t::operator<<( log_level l ) { - s_impl().m_entry_data.m_level = l; + s_log_impl().m_entry_data.m_level = l; return *this; } @@ -328,9 +316,6 @@ unit_test_log_t::operator<<( log_level l ) ut_detail::entry_value_collector unit_test_log_t::operator()( log_level l ) { - if( !s_impl().m_entry_in_progress ) - *this << log::begin(); - *this << l; ut_detail::entry_value_collector res; @@ -339,63 +324,36 @@ unit_test_log_t::operator()( log_level l ) //____________________________________________________________________________// -void -unit_test_log_t::log_exception( log_level l, const_string what ) -{ - *this << log::begin(); - - if( l >= s_impl().m_threshold_level ) { - s_impl().m_log_formatter->log_exception( s_impl().stream(), s_impl().m_checkpoint_data, what ); - s_impl().m_entry_has_value = true; - } - - *this << log::end(); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::log_progress() -{ - *this << log::begin(); - - if( s_impl().m_progress_display ) - ++(*s_impl().m_progress_display); - - *this << log::end(); -} - -//____________________________________________________________________________// - unit_test_log_t& unit_test_log_t::operator<<( const_string value ) { - if( s_impl().m_entry_in_progress && s_impl().m_entry_data.m_level >= s_impl().m_threshold_level && !value.empty() ) { - if( !s_impl().m_entry_has_value ) { - switch( s_impl().m_entry_data.m_level ) { + if( s_log_impl().m_entry_data.m_level >= s_log_impl().m_threshold_level && !value.empty() ) { + if( !s_log_impl().m_entry_in_progress ) { + s_log_impl().m_entry_in_progress = true; + + switch( s_log_impl().m_entry_data.m_level ) { case log_successful_tests: - s_impl().m_log_formatter->begin_log_entry( s_impl().stream(), s_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_INFO ); + s_log_impl().m_log_formatter->log_entry_start( s_log_impl().stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_INFO ); break; case log_messages: - s_impl().m_log_formatter->begin_log_entry( s_impl().stream(), s_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); + s_log_impl().m_log_formatter->log_entry_start( s_log_impl().stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); break; case log_warnings: - s_impl().m_log_formatter->begin_log_entry( s_impl().stream(), s_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_WARNING ); + s_log_impl().m_log_formatter->log_entry_start( s_log_impl().stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_WARNING ); break; case log_all_errors: case log_cpp_exception_errors: case log_system_errors: - s_impl().m_log_formatter->begin_log_entry( s_impl().stream(), s_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_ERROR ); + s_log_impl().m_log_formatter->log_entry_start( s_log_impl().stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_ERROR ); break; case log_fatal_errors: - s_impl().m_log_formatter->begin_log_entry( s_impl().stream(), s_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); + s_log_impl().m_log_formatter->log_entry_start( s_log_impl().stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); break; - case log_progress_only: case log_nothing: case log_test_suites: case invalid_log_level: @@ -403,63 +361,43 @@ unit_test_log_t::operator<<( const_string value ) } } - s_impl().m_log_formatter->log_entry_value( s_impl().stream(), value ); - s_impl().m_entry_has_value = true; + s_log_impl().m_log_formatter->log_entry_value( s_log_impl().stream(), value ); } - + return *this; } //____________________________________________________________________________// void -unit_test_log_t::start( bool log_build_info ) +unit_test_log_t::set_stream( std::ostream& str ) { - s_impl().m_log_formatter->start_log( s_impl().stream(), log_build_info ); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::header( counter_t test_cases_amount ) -{ - if( s_impl().m_threshold_level != log_nothing && test_cases_amount > 0 ) - s_impl().m_log_formatter->log_header( s_impl().stream(), test_cases_amount ); - - if( s_impl().m_threshold_level == log_progress_only ) - s_impl().m_progress_display.reset( - new boost::progress_display( test_cases_amount, s_impl().stream() ) ); - else - s_impl().m_progress_display.reset(); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::finish( counter_t test_cases_amount ) -{ - if( test_cases_amount == 1 ) - log_progress(); - - s_impl().m_log_formatter->finish_log( s_impl().stream() ); -} - -//____________________________________________________________________________// - -void -unit_test_log_t::set_format( const_string log_format_name ) -{ - if( s_impl().m_entry_in_progress ) + if( s_log_impl().m_entry_in_progress ) return; - static fixed_mapping > log_format( - "HRF", HRF, - "XML", XML, + s_log_impl().m_stream = &str; +} - HRF - ); +//____________________________________________________________________________// - if( log_format[log_format_name] == HRF ) +void +unit_test_log_t::set_threshold_level( log_level lev ) +{ + if( s_log_impl().m_entry_in_progress || lev == invalid_log_level ) + return; + + s_log_impl().m_threshold_level = lev; +} + +//____________________________________________________________________________// + +void +unit_test_log_t::set_format( output_format log_format ) +{ + if( s_log_impl().m_entry_in_progress ) + return; + + if( log_format == CLF ) set_formatter( new output::compiler_log_formatter ); else set_formatter( new output::xml_log_formatter ); @@ -470,7 +408,7 @@ unit_test_log_t::set_format( const_string log_format_name ) void unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) { - s_impl().m_log_formatter.reset( the_formatter ); + s_log_impl().m_log_formatter.reset( the_formatter ); } //____________________________________________________________________________// @@ -479,40 +417,17 @@ unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.5 2005/02/02 12:08:14 rogeeff -// namespace log added for log manipulators -// -// Revision 1.4 2005/02/01 08:59:38 rogeeff -// supplied_log_formatters split -// change formatters interface to simplify result interface -// -// Revision 1.3 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.2 2005/01/30 01:59:36 rogeeff -// counter type renamed -// -// Revision 1.1 2005/01/22 19:22:13 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory -// -// Revision 1.27 2005/01/21 07:23:49 rogeeff -// added automatic test case run timing -// -// Revision 1.25 2005/01/18 08:30:08 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// Revision 1.6 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_LOG_IPP_012205GER +#endif // BOOST_TEST_UNIT_TEST_LOG_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_main.ipp b/include/boost/test/impl/unit_test_main.ipp index 2d8ed173..95cbe17f 100644 --- a/include/boost/test/impl/unit_test_main.ipp +++ b/include/boost/test/impl/unit_test_main.ipp @@ -12,23 +12,27 @@ // Description : main function implementation for Unit Test Framework // *************************************************************************** -#ifndef BOOST_UNIT_TEST_MAIN_IPP_012205GER -#define BOOST_UNIT_TEST_MAIN_IPP_012205GER +#ifndef BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER // Boost.Test +#include +#include #include -#include -#include +#include + #include -#include // Boost -#include +#include // STL -#include // for cout, cerr +#include +#include -extern boost::unit_test::test_suite* init_unit_test_suite( int argc, char* argv[] ); // prototype for user's test suite init function +#include + +//____________________________________________________________________________// // ************************************************************************** // // ************** unit test main ************** // @@ -38,95 +42,41 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) { using namespace boost::unit_test; - using namespace boost::unit_test::ut_detail; + + try { + framework::init( argc, argv ); - bool no_result_code; - bool print_build_info; + framework::run(); - // set the log level - unit_test_log.set_threshold_level_by_name( retrieve_framework_parameter( LOG_LEVEL, &argc, argv ) ); + results_reporter::make_report(); - // set the log/report format - const_string output_format = retrieve_framework_parameter( OUTPUT_FORMAT, &argc, argv ); - - if( output_format.empty() ) { - unit_test_log.set_format( retrieve_framework_parameter( LOG_FORMAT, &argc, argv ) ); - unit_test_result::set_report_format( retrieve_framework_parameter( REPORT_FORMAT, &argc, argv ) ); + return runtime_config::no_result_code() + ? boost::exit_success + : results_collector.results( framework::master_test_suite().p_id ).result_code(); } - else { - unit_test_log.set_format( output_format ); - unit_test_result::set_report_format( output_format ); + catch( std::logic_error const& ex ) { + std::cerr << "Boost.Test internal framework error: " << ex.what() << std::endl; + + return boost::exit_exception_failure; } - - // set the result code and build info flags - no_result_code = retrieve_framework_parameter( NO_RESULT_CODE, &argc, argv ) == "no"; - print_build_info = retrieve_framework_parameter( BUILD_INFO, &argc, argv ) == "yes"; - - // set catch_system_error switch - unit_test_monitor::catch_system_errors( retrieve_framework_parameter( CATCH_SYS_ERRORS, &argc, argv ) != "no" ); - - // save report level for future reporting - const_string report_level = retrieve_framework_parameter( REPORT_LEVEL, &argc, argv ); - - // init master unit test suite - boost::scoped_ptr test( init_unit_test_suite( argc, argv ) ); - if( !test ) { - std::cerr << "*** Fail to initialize test suite" << std::endl; - return boost::exit_test_failure; + catch( ... ) { + std::cerr << "Boost.Test internal framework error: unknown reason" << std::endl; + + return boost::exit_exception_failure; } - - if( retrieve_framework_parameter( DETECT_MEM_LEAKS, &argc, argv ) == "yes" ) - boost::detect_memory_leaks(); - - // start testing - unit_test_log.start( print_build_info ); - unit_test_log.header( test->size() ); - test->run(); - unit_test_log.finish( test->size() ); - - // report results - unit_test_result::instance().report( report_level, std::cerr ); - - // return code - return no_result_code ? boost::exit_success : unit_test_result::instance().result_code(); } +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.5 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.4 2005/01/31 07:50:06 rogeeff -// cdecl portability fix -// -// Revision 1.3 2005/01/31 06:01:54 rogeeff -// BOOST_TEST_CALL_DECL correctness fixes -// -// Revision 1.2 2005/01/30 01:55:13 rogeeff -// eliminated dependency on log -// -// Revision 1.1 2005/01/22 19:22:13 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory -// -// Revision 1.18 2005/01/19 16:34:07 vawjr -// Changed the \r\r\n back to \r\n on windows so we don't get errors when compiling -// on VC++8.0. I don't know why Microsoft thinks it's a good idea to call this an error, -// but they do. I also don't know why people insist on checking out files on Windows and -// copying them to a unix system to check them in (which will cause exactly this problem) -// -// Revision 1.17 2005/01/18 08:30:08 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// Revision 1.6 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_MAIN_IPP_012205GER +#endif // BOOST_TEST_UNIT_TEST_MAIN_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_monitor.ipp b/include/boost/test/impl/unit_test_monitor.ipp index edf499f8..9ab9b089 100644 --- a/include/boost/test/impl/unit_test_monitor.ipp +++ b/include/boost/test/impl/unit_test_monitor.ipp @@ -1,5 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. -// (C) Copyright Ullrich Koethe 2001. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -14,48 +13,54 @@ // Test Framework to monitor test cases run. // *************************************************************************** -#ifndef BOOST_UNIT_TEST_MONITOR_IPP_012205GER -#define BOOST_UNIT_TEST_MONITOR_IPP_012205GER +#ifndef BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER // Boost.Test -#include -#include -#include +#include #include #include +#include + +#include + +#include + +//____________________________________________________________________________// namespace boost { namespace unit_test { -namespace ut_detail { +namespace { +struct zero_return_wrapper { + explicit zero_return_wrapper( callback0<> const& f ) : m_f( f ) {} + + int operator()() { m_f(); return 0; } + + callback0<> const& m_f; +}; + +} // ************************************************************************** // // ************** unit_test_monitor ************** // // ************************************************************************** // -bool unit_test_monitor::s_catch_system_errors = true; - -unit_test_monitor::error_level -unit_test_monitor::execute_and_translate( test_case* target_test_case, function_to_monitor f, int timeout ) +unit_test_monitor_t::error_level +unit_test_monitor_t::execute_and_translate( test_case const& tc ) { - m_test_case = target_test_case; - m_test_case_method = f; - try { - execute( s_catch_system_errors, timeout ); + execute( callback0( zero_return_wrapper( tc.test_func() ) ), + runtime_config::catch_sys_errors(), + tc.p_timeout ); } - catch( execution_exception const& exex ) { - log_level loglevel = - exex.code() <= execution_exception::cpp_exception_error ? log_cpp_exception_errors : - (exex.code() <= execution_exception::timeout_error ? log_system_errors : - log_fatal_errors); - unit_test_log.log_exception( loglevel, exex.what() ); - - unit_test_result::instance().caught_exception(); + catch( execution_exception const& ex ) { + framework::exception_caught( ex ); + framework::test_unit_aborted(); // translate execution_exception::error_code to error_level - switch( exex.code() ) { + switch( ex.code() ) { case execution_exception::no_error: return test_ok; case execution_exception::user_error: return unexpected_exception; case execution_exception::cpp_exception_error: return unexpected_exception; @@ -72,31 +77,21 @@ unit_test_monitor::execute_and_translate( test_case* target_test_case, function_ //____________________________________________________________________________// -int -unit_test_monitor::function() -{ - try { - (m_test_case->*m_test_case_method)(); - } - catch( test_tools::tt_detail::test_tool_failed const& /*e*/ ) { // e not used; error already reported - // nothing to do - } - - return 0; -} - -//____________________________________________________________________________// - -} // namespace ut_detail - } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.3 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.2 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed @@ -122,4 +117,4 @@ unit_test_monitor::function() // // *************************************************************************** -#endif // BOOST_UNIT_TEST_MONITOR_IPP_012205GER +#endif // BOOST_TEST_UNIT_TEST_MONITOR_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_parameters.ipp b/include/boost/test/impl/unit_test_parameters.ipp index 8a7cec24..196eedad 100644 --- a/include/boost/test/impl/unit_test_parameters.ipp +++ b/include/boost/test/impl/unit_test_parameters.ipp @@ -1,6 +1,6 @@ // (C) Copyright Gennadiy Rozental 2001-2005. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,17 +9,18 @@ // // Version : $Revision$ // -// Description : simple implementation for Unit Test Framework parameter -// handling routines. May be rewritten in future to use some kind of -// command-line arguments parsing facility and environment variable handling +// Description : simple implementation for Unit Test Framework parameter +// handling routines. May be rewritten in future to use some kind of +// command-line arguments parsing facility and environment variable handling // facility // *************************************************************************** -#ifndef BOOST_UNIT_TEST_PARAMETERS_IPP_012205GER -#define BOOST_UNIT_TEST_PARAMETERS_IPP_012205GER +#ifndef BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER // Boost.Test #include +#include #include #include @@ -28,14 +29,50 @@ #include #include +#include + +//____________________________________________________________________________// + # ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::getenv; using ::strncmp; using ::strcmp; } # endif namespace boost { - + namespace unit_test { +namespace { + +// framework parameters and there corresponding command-line arguments +literal_string LOG_LEVEL = "BOOST_TEST_LOG_LEVEL"; +literal_string NO_RESULT_CODE = "BOOST_TEST_RESULT_CODE"; +literal_string REPORT_LEVEL = "BOOST_TEST_REPORT_LEVEL"; +literal_string TESTS_TO_RUN = "BOOST_TESTS_TO_RUN"; +literal_string SAVE_TEST_PATTERN = "BOOST_TEST_SAVE_PATTERN"; +literal_string BUILD_INFO = "BOOST_TEST_BUILD_INFO"; +literal_string SHOW_PROGRESS = "BOOST_TEST_SHOW_PROGRESS"; +literal_string CATCH_SYS_ERRORS = "BOOST_TEST_CATCH_SYSTEM_ERRORS"; +literal_string REPORT_FORMAT = "BOOST_TEST_REPORT_FORMAT"; +literal_string LOG_FORMAT = "BOOST_TEST_LOG_FORMAT"; +literal_string OUTPUT_FORMAT = "BOOST_TEST_OUTPUT_FORMAT"; +literal_string DETECT_MEM_LEAKS = "BOOST_TEST_DETECT_MEMORY_LEAKS"; + +unit_test::log_level s_log_level; +bool s_no_result_code; +unit_test::report_level s_report_level; +const_string s_tests_to_run; +bool s_save_pattern; +bool s_show_build_info; +bool s_show_progress; +bool s_catch_sys_errors; +output_format s_report_format; +output_format s_log_format; +bool s_detect_mem_leaks; + +// ************************************************************************** // +// ************** runtime_config ************** // +// ************************************************************************** // + const_string retrieve_framework_parameter( const_string parameter_name, int* argc, char** argv ) { @@ -46,6 +83,7 @@ retrieve_framework_parameter( const_string parameter_name, int* argc, char** arg TESTS_TO_RUN , "--run_test", SAVE_TEST_PATTERN , "--save_pattern", BUILD_INFO , "--build_info", + SHOW_PROGRESS , "--show_progress", CATCH_SYS_ERRORS , "--catch_system_errors", REPORT_FORMAT , "--report_format", LOG_FORMAT , "--log_format", @@ -62,15 +100,15 @@ retrieve_framework_parameter( const_string parameter_name, int* argc, char** arg if( !cla_name.is_empty() ) { for( int i = 1; i < *argc; ++i ) { - if( cla_name == const_string( argv[i], cla_name.size() ) && + if( cla_name == const_string( argv[i], cla_name.size() ) && argv[i][cla_name.size()] == '=' ) { const_string result = argv[i] + cla_name.size() + 1; - + for( int j = i; j < *argc; ++j ) { argv[j] = argv[j+1]; } --(*argc); - + return result; } } @@ -80,28 +118,176 @@ retrieve_framework_parameter( const_string parameter_name, int* argc, char** arg return std::getenv( parameter_name.begin() ); } +} // local namespace + //____________________________________________________________________________// +namespace runtime_config { + +void +init( int* argc, char** argv ) +{ + fixed_mapping > log_level_name( + "all" , log_successful_tests, + "success" , log_successful_tests, + "test_suite" , log_test_suites, + "message" , log_messages, + "warning" , log_warnings, + "error" , log_all_errors, + "cpp_exception" , log_cpp_exception_errors, + "system_error" , log_system_errors, + "fatal_error" , log_fatal_errors, + "nothing" , log_nothing, + + invalid_log_level + ); + + fixed_mapping > report_level_name ( + "confirm", CONFIRMATION_REPORT, + "short", SHORT_REPORT, + "detailed", DETAILED_REPORT, + "no", NO_REPORT, + + INV_REPORT_LEVEL + ); + + fixed_mapping > output_format_name ( + "HRF", CLF, + "CLF", CLF, + "XML", XML, + + CLF + ); + + s_no_result_code = retrieve_framework_parameter( NO_RESULT_CODE, argc, argv ) == "no"; + s_save_pattern = retrieve_framework_parameter( SAVE_TEST_PATTERN, argc, argv ) == "yes"; + s_show_build_info = retrieve_framework_parameter( BUILD_INFO, argc, argv ) == "yes"; + s_show_progress = retrieve_framework_parameter( SHOW_PROGRESS, argc, argv ) == "yes"; + s_catch_sys_errors = retrieve_framework_parameter( CATCH_SYS_ERRORS, argc, argv ) != "no"; + s_tests_to_run = retrieve_framework_parameter( TESTS_TO_RUN, argc, argv ); + + s_log_level = log_level_name[retrieve_framework_parameter( LOG_LEVEL, argc, argv )]; + s_report_level = report_level_name[retrieve_framework_parameter( REPORT_LEVEL, argc, argv )]; + + s_report_format = output_format_name[retrieve_framework_parameter( REPORT_FORMAT, argc, argv )]; + s_log_format = output_format_name[retrieve_framework_parameter( LOG_FORMAT, argc, argv )]; + + const_string output_format = retrieve_framework_parameter( OUTPUT_FORMAT, argc, argv ); + if( !output_format.is_empty() ) { + s_report_format = output_format_name[output_format]; + s_log_format = output_format_name[output_format]; + } + + s_detect_mem_leaks = retrieve_framework_parameter( DETECT_MEM_LEAKS, argc, argv ) != "no"; +} + +//____________________________________________________________________________// + +unit_test::log_level +log_level() +{ + return s_log_level; +} + +//____________________________________________________________________________// + +bool +no_result_code() +{ + return s_no_result_code; +} + +//____________________________________________________________________________// + +unit_test::report_level +report_level() +{ + return s_report_level; +} + +//____________________________________________________________________________// + +const_string +test_to_run() +{ + return s_tests_to_run; +} + +//____________________________________________________________________________// + +bool +save_pattern() +{ + return s_save_pattern; +} + +//____________________________________________________________________________// + +bool +show_progress() +{ + return s_show_progress; +} + +//____________________________________________________________________________// + +bool +show_build_info() +{ + return s_show_build_info; +} + +//____________________________________________________________________________// + +bool +catch_sys_errors() +{ + return s_catch_sys_errors; +} + +//____________________________________________________________________________// + +output_format +report_format() +{ + return s_report_format; +} + +//____________________________________________________________________________// + +output_format +log_format() +{ + return s_log_format; +} + +//____________________________________________________________________________// + +bool +detect_memory_leaks() +{ + return s_detect_mem_leaks; +} + +//____________________________________________________________________________// + +} // namespace runtime_config + } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : -// +// // $Log$ -// Revision 1.3 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.2 2005/01/31 05:58:03 rogeeff -// detect_memory_leaks feature added -// -// Revision 1.1 2005/01/22 19:22:13 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory +// Revision 1.4 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_PARAMETERS_IPP_012205GER +#endif // BOOST_TEST_UNIT_TEST_PARAMETERS_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_result.ipp b/include/boost/test/impl/unit_test_result.ipp deleted file mode 100644 index 90cf6427..00000000 --- a/include/boost/test/impl/unit_test_result.ipp +++ /dev/null @@ -1,619 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : implements Unit Test Result reporting facility. Note that majority of -// implementation is hidden in this file using pimple idiom. -// *************************************************************************** - -#ifndef BOOST_UNIT_TEST_RESULT_IPP_012205GER -#define BOOST_UNIT_TEST_RESULT_IPP_012205GER - -// Boost.Test -#include -#include -#include -#include -#include -#include - -// Boost -#include -#include -#include - -// STL -#include -#include -#include -#include -#include -#include -#include - -# ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::log10; using ::strncmp; } -# endif - -namespace boost { - -namespace unit_test { - -typedef unit_test_result* unit_test_result_ptr; - -// ************************************************************************** // -// ************** report_formatter ************** // -// ************************************************************************** // - -class report_formatter { -public: - // Destructor - virtual ~report_formatter() {} - - virtual void start_result_report( std::ostream& where_to ) = 0; - virtual void finish_result_report( std::ostream& where_to ) = 0; - - virtual void start_test_case_report( std::ostream& where_to, std::size_t indent, - const_string test_case_name, bool case_suite, bool failed ) = 0; - - virtual void start_confirmation_report( std::ostream& where_to, - const_string test_case_name, bool case_suite, bool failed, - counter_t num_failed, counter_t num_expected ) = 0; - - virtual void finish_test_case_report( std::ostream& where_to, std::size_t indent, - const_string test_case_name, bool case_suite, bool aborted ) = 0; - - virtual void report_sub_test_cases_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, counter_t num_failed ) = 0; - - virtual void report_assertions_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, - counter_t num_failed, - counter_t num_expected ) = 0; - -}; - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** hrf_report_formatter ************** // -// ************************************************************************** // - -class hrf_report_formatter : public report_formatter { - struct quote { - explicit quote( const_string str ) : m_str( str ) {} - - friend std::ostream& operator<<( std::ostream& os, quote const& q ) - { - return os << '"' << q.m_str << '"'; - } - - private: - const_string m_str; - }; -public: - void start_result_report( std::ostream& /* where_to */ ) {} - void finish_result_report( std::ostream& /* where_to */ ) {} - - void start_test_case_report( std::ostream& where_to, std::size_t indent, - const_string test_case_name, bool case_suite, bool failed ) - { - where_to << "\n" << std::setw( indent ) << "" << "Test " << cs_name( case_suite ) << " " << quote( test_case_name ) - << (failed ? " failed with:\n" : " passed with:\n"); - - } - - void start_confirmation_report( std::ostream& where_to, - const_string test_case_name, bool case_suite, bool failed, - counter_t num_failed, counter_t num_expected ) - { - if( failed ) { - if( num_failed == 0 ) { - where_to << "\n*** errors detected in test " << cs_name( case_suite ) << " " << quote( test_case_name ) - << "; see standard output for details\n"; - return; - } - - - where_to << "\n*** " << num_failed << ps_name( num_failed != 1, " failure" ) << " detected"; - - if( num_expected > 0 ) - where_to << " (" << num_expected << ps_name( num_expected != 1, " failure" ) << " expected)"; - - where_to << " in test " << cs_name( case_suite ) << " " << quote( test_case_name ) << "\n"; - } - else - where_to << "\n*** No errors detected\n"; - } - - void finish_test_case_report( std::ostream& where_to, std::size_t indent, - const_string test_case_name, bool case_suite, bool aborted ) - { - if( aborted ) - where_to << std::setw( indent ) << "" << "Test " << cs_name( case_suite ) << " " << quote( test_case_name ) - << " was aborted due to uncaught exception, user assert or system error\n"; - - where_to.flush(); - } - - void report_sub_test_cases_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, counter_t num_failed ) - { - counter_t total_test_cases = num_passed + num_failed; - std::size_t width = static_cast( std::log10( (float)(std::max)( num_passed, num_failed ) ) ) + 1; - - where_to << std::setw( indent ) << "" << std::setw( width ) << num_passed - << " test " << ps_name( num_passed != 1, "case" ) << " out of " << total_test_cases << " passed\n" - << std::setw( indent ) << "" << std::setw( width ) << num_failed - << " test " << ps_name( num_failed != 1, "case" ) << " out of " << total_test_cases << " failed\n"; - - } - - void report_assertions_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, counter_t num_failed, counter_t num_expected ) - { - counter_t total_assertions = num_passed + num_failed; - std::size_t width = total_assertions > 0 - ? static_cast( std::log10( (float)(std::max)( num_passed, num_failed ) ) ) + 1 - : 1; - - where_to << std::setw( indent ) << "" << std::setw( width ) << num_passed - << ps_name( num_passed != 1, " assertion" ) << " out of " << total_assertions << " passed\n" - << std::setw( indent ) << "" << std::setw( width ) << num_failed - << ps_name( num_failed != 1, " assertion" ) << " out of " << total_assertions << " failed\n"; - - if( num_expected > 0 ) - where_to << std::setw( indent ) << "" << "while " << num_expected - << ps_name( num_expected != 1, " failure" ) << " expected\n"; - } - -private: - static std::string ps_name( bool p_s, std::string singular_form ) - { - return p_s ? singular_form.append( "s" ) : singular_form; - } - static std::string cs_name( bool c_s ) - { - return c_s ? "case" : "suite"; - } -}; - -// ************************************************************************** // -// ************** xml_report_formatter ************** // -// ************************************************************************** // - -class xml_report_formatter : public report_formatter { -public: - void start_result_report( std::ostream& where_to ) - { - where_to << "\n"; - } - void finish_result_report( std::ostream& where_to ) - { - where_to << "\n"; - } - - void start_test_case_report( std::ostream& where_to, std::size_t indent, - const_string test_case_name, bool case_suite, bool failed ) - { - where_to << std::setw( indent ) << "" - << "<" << ( case_suite ? "TestCase" : "TestSuite" ) - << " name" << attr_value() << test_case_name - << " result" << attr_value() << (failed ? "failed" : "passed") << ">\n"; - } - - void start_confirmation_report( std::ostream& where_to, - const_string test_case_name, bool case_suite, bool failed, - counter_t num_failed, counter_t num_expected ) - { - where_to << "<" << ( case_suite ? "TestCase" : "TestSuite" ) - << " name" << attr_value() << test_case_name - << " result" << attr_value() << (failed ? "failed" : "passed"); - - if( failed ) { - where_to << " num_of_failures" << attr_value() << num_failed - << " expected_failures" << attr_value() << num_expected; - } - - where_to << ">\n"; - } - - void finish_test_case_report( std::ostream& where_to, std::size_t indent, - const_string /* test_case_name */, bool case_suite, bool aborted ) - { - if( aborted ) { - where_to << std::setw( indent+2 ) << "" - << "<" << "aborted" - << " reason" << attr_value() << "due to uncaught exception, user assert or system error" - << "/>\n"; - } - - where_to << std::setw( indent ) << "" - << "\n"; - } - - void report_sub_test_cases_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, counter_t num_failed ) - { - where_to << std::setw( indent+2 ) << "" - << "\n"; - } - - void report_assertions_stat( std::ostream& where_to, std::size_t indent, - counter_t num_passed, - counter_t num_failed, - counter_t num_expected ) - { - where_to << std::setw( indent+2 ) << "" - << "\n"; - } -}; - -// ************************************************************************** // -// ************** unit_test_result ************** // -// ************************************************************************** // - -struct unit_test_result::Impl { - unit_test_result_ptr m_parent; - std::list m_children; - counter_t m_assertions_passed; - counter_t m_assertions_failed; - counter_t m_expected_failures; - counter_t m_test_cases_passed; - counter_t m_test_cases_failed; - bool m_exception_caught; - std::string m_test_case_name; - - static boost::scoped_ptr m_head; - static unit_test_result_ptr m_curr; - static boost::scoped_ptr m_report_formatter; - - bool has_failed() - { - return m_test_cases_failed != 0 || m_assertions_failed != m_expected_failures || m_exception_caught; - } - int result_code() - { - return has_failed() - ? ( (m_assertions_failed != 0) - ? boost::exit_test_failure - : boost::exit_exception_failure ) - : boost::exit_success; - } -}; - -boost::scoped_ptr unit_test_result::Impl::m_head; -unit_test_result_ptr unit_test_result::Impl::m_curr = unit_test_result_ptr(); -boost::scoped_ptr unit_test_result::Impl::m_report_formatter( new hrf_report_formatter ); - -//____________________________________________________________________________// - -unit_test_result::unit_test_result( unit_test_result_ptr parent, const_string test_case_name, counter_t exp_fail ) -: m_pimpl( new Impl ) -{ - m_pimpl->m_parent = parent; - test_case_name.assign_to( m_pimpl->m_test_case_name ); - - m_pimpl->m_assertions_passed = 0; - m_pimpl->m_assertions_failed = 0; - m_pimpl->m_expected_failures = exp_fail; - m_pimpl->m_test_cases_passed = 0; - m_pimpl->m_test_cases_failed = 0; - m_pimpl->m_exception_caught = false; - -} - -//____________________________________________________________________________// - -static void safe_delete( unit_test_result_ptr ptr ) { boost::checked_delete( ptr ); } - -unit_test_result::~unit_test_result() -{ - std::list::iterator beg = m_pimpl->m_children.begin(); - std::list::iterator end = m_pimpl->m_children.end(); - - std::for_each( beg, end, &safe_delete ); -} - -//____________________________________________________________________________// - -unit_test_result& -unit_test_result::instance() -{ - assert( !!Impl::m_head ); - - return Impl::m_curr ? *Impl::m_curr : *Impl::m_head; -} - -//____________________________________________________________________________// - -void -unit_test_result::test_case_enter( const_string name, counter_t expected_failures ) -{ - unit_test_result_ptr new_test_case_result_inst = new unit_test_result( Impl::m_curr, name, expected_failures ); - - if( Impl::m_curr ) - Impl::m_curr->m_pimpl->m_children.push_back( new_test_case_result_inst ); - else - Impl::m_head.reset( new_test_case_result_inst ); - - Impl::m_curr = new_test_case_result_inst; -} - -//____________________________________________________________________________// - -void -unit_test_result::test_case_exit() -{ - assert( !!Impl::m_curr ); - - Impl* curr_impl = Impl::m_curr->m_pimpl.get(); - unit_test_result_ptr parent = curr_impl->m_parent; - - if( parent ) { - // accumulate results - parent->m_pimpl->m_assertions_passed += curr_impl->m_assertions_passed; - parent->m_pimpl->m_assertions_failed += curr_impl->m_assertions_failed; - parent->m_pimpl->m_test_cases_passed += curr_impl->m_test_cases_passed; - parent->m_pimpl->m_test_cases_failed += curr_impl->m_test_cases_failed; - - // for test_cases (vs. test_suite) //!! need better identification - if( curr_impl->m_test_cases_passed == 0 && curr_impl->m_test_cases_failed == 0 ) { - if( curr_impl->has_failed() ) - parent->m_pimpl->m_test_cases_failed++; - else - parent->m_pimpl->m_test_cases_passed++; - } - - } - - Impl::m_curr = parent; -} - -//____________________________________________________________________________// - -struct report_format_name_map : std::map -{ - report_format_name_map() {} -}; - -void -unit_test_result::set_report_format( const_string report_format_name ) -{ - static fixed_mapping > report_format( - "HRF", HRF, - "XML", XML, - - HRF - ); - - if( report_format[report_format_name] == HRF ) - Impl::m_report_formatter.reset( new hrf_report_formatter ); - else - Impl::m_report_formatter.reset( new xml_report_formatter ); -} - -//____________________________________________________________________________// - -void -unit_test_result::increase_expected_failures( counter_t amount ) -{ - m_pimpl->m_expected_failures += amount; - - if( m_pimpl->m_parent ) - m_pimpl->m_parent->increase_expected_failures( amount ); -} - -//____________________________________________________________________________// - -void -unit_test_result::inc_failed_assertions() -{ - m_pimpl->m_assertions_failed++; - - if( m_pimpl->m_assertions_failed == 1 ) - first_failed_assertion(); -} - -//____________________________________________________________________________// - -void -unit_test_result::inc_passed_assertions() -{ - m_pimpl->m_assertions_passed++; -} - -//____________________________________________________________________________// - -void -unit_test_result::caught_exception() -{ - m_pimpl->m_exception_caught = true; -} - -//____________________________________________________________________________// - -void -unit_test_result::reset_current_result_set() -{ - static unit_test_result_ptr backup = unit_test_result_ptr(); - static boost::scoped_ptr temporary_substitute; - - assert( !!Impl::m_curr ); - - if( backup ) { - Impl::m_curr = backup; - backup = unit_test_result_ptr(); - temporary_substitute.reset(); - } - else { - backup = Impl::m_curr; - Impl::m_curr = new unit_test_result( NULL, Impl::m_curr->m_pimpl->m_test_case_name, 0 ); - temporary_substitute.reset( Impl::m_curr ); - } -} - -//____________________________________________________________________________// - -void -unit_test_result::failures_details( counter_t& num_of_failures, bool& exception_caught ) -{ - num_of_failures = m_pimpl->m_assertions_failed; - exception_caught = m_pimpl->m_exception_caught; -} - -//____________________________________________________________________________// - -void -unit_test_result::report( const_string reportlevel, std::ostream& where_to_ ) -{ - static int const map_size = sizeof(report_level_names)/sizeof(const_string); - - report_level rl = UNDEF_REPORT; - if( reportlevel.empty() ) - rl = CONFIRMATION_REPORT; - else { - for( int i = 0; i < map_size; i++ ) { - if( reportlevel == report_level_names[i] ) { - rl = (report_level)i; - break; - } - } - } - - switch( rl ) { - case CONFIRMATION_REPORT: - confirmation_report( where_to_ ); - break; - case SHORT_REPORT: - case DETAILED_REPORT: - m_pimpl->m_report_formatter->start_result_report( where_to_ ); - report_result( where_to_, 0, rl == DETAILED_REPORT ); - m_pimpl->m_report_formatter->finish_result_report( where_to_ ); - break; - case NO_REPORT: - break; - default: - where_to_ << "*** Unrecognized report level" << std::endl; - break; - } -} - -//____________________________________________________________________________// - -void -unit_test_result::confirmation_report( std::ostream& where_to ) -{ - assert( !!this ); - - m_pimpl->m_report_formatter->start_result_report( where_to ); - - m_pimpl->m_report_formatter->start_confirmation_report( where_to, - m_pimpl->m_test_case_name, m_pimpl->m_children.empty(), - m_pimpl->m_test_cases_failed != 0 || m_pimpl->has_failed(), - m_pimpl->m_assertions_failed, m_pimpl->m_expected_failures ); - - m_pimpl->m_report_formatter->finish_test_case_report( where_to, 0, - m_pimpl->m_test_case_name, m_pimpl->m_children.empty(), - m_pimpl->m_exception_caught ); - - m_pimpl->m_report_formatter->finish_result_report( where_to ); -} - -//____________________________________________________________________________// - -void -unit_test_result::report_result( std::ostream& where_to, std::size_t indent, bool detailed ) -{ - assert( !!this ); - - m_pimpl->m_report_formatter->start_test_case_report( where_to, indent, - m_pimpl->m_test_case_name, m_pimpl->m_children.empty(), - m_pimpl->m_test_cases_failed != 0 || m_pimpl->has_failed() ); - - if( m_pimpl->m_test_cases_passed + m_pimpl->m_test_cases_failed > 1 ) - m_pimpl->m_report_formatter->report_sub_test_cases_stat( where_to, indent, - m_pimpl->m_test_cases_passed, m_pimpl->m_test_cases_failed ); - - m_pimpl->m_report_formatter->report_assertions_stat( where_to, indent, - m_pimpl->m_assertions_passed, - m_pimpl->m_assertions_failed, - m_pimpl->m_expected_failures ); - - if( detailed ) { - std::list::iterator it = m_pimpl->m_children.begin(); - std::list::iterator end = m_pimpl->m_children.end(); - - while( it != end ) { - unit_test_result_ptr next = *(it++); - next->report_result( where_to, indent+2, true ); - } - } - - m_pimpl->m_report_formatter->finish_test_case_report( where_to, indent, - m_pimpl->m_test_case_name, m_pimpl->m_children.empty(), - m_pimpl->m_exception_caught ); -} - -//____________________________________________________________________________// - -int -unit_test_result::result_code() const -{ - return m_pimpl->result_code(); -} - -//____________________________________________________________________________// - -bool -unit_test_result::has_passed() const -{ - return !m_pimpl->has_failed(); -} - -//____________________________________________________________________________// - -} // namespace unit_test - -} // namespace boost - -// *************************************************************************** -// Revision History : -// -// $Log$ -// Revision 1.4 2005/02/01 08:59:38 rogeeff -// supplied_log_formatters split -// change formatters interface to simplify result interface -// -// Revision 1.3 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.2 2005/01/30 01:56:10 rogeeff -// counter type renamed -// -// Revision 1.1 2005/01/22 19:22:13 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory -// -// Revision 1.32 2005/01/21 07:26:41 rogeeff -// xml printing helpers reworked to employ generic custom manipulators -// -// *************************************************************************** - -#endif // BOOST_UNIT_TEST_RESULT_IPP_012205GER diff --git a/include/boost/test/impl/unit_test_suite.ipp b/include/boost/test/impl/unit_test_suite.ipp index 9f81f083..8f4880bb 100644 --- a/include/boost/test/impl/unit_test_suite.ipp +++ b/include/boost/test/impl/unit_test_suite.ipp @@ -1,6 +1,6 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -9,197 +9,79 @@ // // Version : $Revision$ // -// Description : privide core implementation for Unit Test Framework. +// Description : privide core implementation for Unit Test Framework. // Extensions could be provided in separate files // *************************************************************************** -#ifndef BOOST_UNIT_TEST_SUITE_IPP_012205GER -#define BOOST_UNIT_TEST_SUITE_IPP_012205GER +#ifndef BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER +#define BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER // Boost.Test #include -#include -#include -#include +#include +#include +#include // Boost -#include #include // STL -#include #include #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { // ************************************************************************** // -// ************** test_case_scope_tracker ************** // +// ************** test_unit ************** // // ************************************************************************** // -struct test_case_scope_tracker { - explicit test_case_scope_tracker( test_case const& tc ) - : m_tc( tc ) - { - unit_test_log.test_case_enter( m_tc ); - unit_test_result::test_case_enter( m_tc.p_name.get(), m_tc.p_expected_failures ); - } - ~test_case_scope_tracker() - { - unit_test_log.test_case_exit( m_tc, (long)(m_timer.elapsed() * 1e6) ); - unit_test_result::test_case_exit(); - } - -private: - test_case const& m_tc; - boost::timer m_timer; -}; - -// ************************************************************************** // -// ************** test_case ************** // -// ************************************************************************** // - -ut_detail::unit_test_monitor the_monitor; - -typedef unit_test_result const* unit_test_result_cptr; - -struct test_case::Impl { - Impl( bool monitor_run_ ) : m_monitor_run( monitor_run_ ), m_results_set( unit_test_result_cptr() ) {} - - bool m_monitor_run; // true - unit_test_monitor will be user to monitor running - // of implementation function - std::list m_dependencies_list; // list of test cases this test case depends on. We won't run it until they pass - unit_test_result_cptr m_results_set; // results set instance reference for this test case - - static bool s_abort_testing; // used to flag critical error and try gracefully stop testing - - bool check_dependencies(); -}; - -bool test_case::Impl::s_abort_testing = false; - -//____________________________________________________________________________// - - -inline bool -test_case::Impl::check_dependencies() +test_unit::test_unit( const_string name, test_unit_type t ) +: p_name( std::string( name.begin(), name.size() ) ) +, p_type( t ) +, p_type_name( t == tut_case ? "case" : "suite" ) +, p_id( INV_TEST_UNIT_ID ) { - return std::find_if( m_dependencies_list.begin(), - m_dependencies_list.end(), - std::not1( boost::mem_fn( &test_case::has_passed ) ) ) == m_dependencies_list.end(); -} - -//____________________________________________________________________________// - -test_case::test_case( const_string name, bool type, counter_t stages_amount, bool monitor_run ) -: p_timeout( 0 ) -, p_expected_failures( 0 ) -, p_type( type ) -, p_name( std::string( name.begin(), name.end() ) ) -, p_compound_stage( false ) -, p_stages_amount( stages_amount ) -, m_pimpl( new Impl( monitor_run ) ) -{ -} - -//____________________________________________________________________________// - -counter_t -test_case::size() const -{ - return 1; } //____________________________________________________________________________// void -test_case::depends_on( test_case const* rhs ) +test_unit::depends_on( test_unit* tu ) { - m_pimpl->m_dependencies_list.push_back( rhs ); + m_dependencies.push_back( tu->p_id ); } //____________________________________________________________________________// bool -test_case::has_passed() const +test_unit::check_dependencies() const { - return m_pimpl->m_results_set != unit_test_result_cptr() && m_pimpl->m_results_set->has_passed(); + BOOST_TEST_FOREACH( test_unit_id, tu_id, m_dependencies ) { + if( !unit_test::results_collector.results( tu_id ).passed() ) + return false; + } + + return true; } //____________________________________________________________________________// -void -test_case::run() +// ************************************************************************** // +// ************** test_case ************** // +// ************************************************************************** // + +test_case::test_case( const_string name, callback0<> const& test_func ) +: test_unit( name, (test_unit_type)type ) +, m_test_func( test_func ) { - using ut_detail::unit_test_monitor; - - // 0. Check if we allowed to run this test case - if( !m_pimpl->check_dependencies() ) - return; + 0; // !! weirdest MSVC BUG; try to remove this statement; looks like it eats first token of next statement - test_case_scope_tracker scope_tracker( *this ); - - m_pimpl->s_abort_testing = false; - - // 1. Init test results - m_pimpl->m_results_set = &unit_test_result::instance(); - - // 2. Initialize test case - if( m_pimpl->m_monitor_run ) { - error_level_type setup_result = - the_monitor.execute_and_translate( this, &test_case::do_init, p_timeout ); - - if( setup_result != unit_test_monitor::test_ok ) { - m_pimpl->s_abort_testing = unit_test_monitor::is_critical_error( setup_result ); - - BOOST_UT_LOG_ENTRY( log_fatal_errors ) << "Test case setup has failed"; - - return; - } - } - else { - do_init(); - } - - // 3. Run test case (all stages) - for( counter_t i=0; i != p_stages_amount; ++i ) { - p_compound_stage.value = false; // could be set by do_run to mark compound stage; - // than no need to report progress here - - if( m_pimpl->m_monitor_run ) { - error_level_type run_result = - the_monitor.execute_and_translate( this, &test_case::do_run, p_timeout ); - - if( unit_test_monitor::is_critical_error( run_result ) ) { - m_pimpl->s_abort_testing = true; - - BOOST_UT_LOG_ENTRY( log_fatal_errors ) << "Testing aborted"; - } - - if( m_pimpl->s_abort_testing ) - return; - } - else { - do_run(); - } - - if( p_stages_amount != 1 && !p_compound_stage ) // compound test - unit_test_log.log_progress(); - } - - // 3. Finalize test case - if( m_pimpl->m_monitor_run ) { - error_level_type teardown_result = - the_monitor.execute_and_translate( this, &test_case::do_destroy, p_timeout ); - - m_pimpl->s_abort_testing = unit_test_monitor::is_critical_error( teardown_result ); - } - else { - do_destroy(); - } + framework::register_test_unit( this ); } //____________________________________________________________________________// @@ -208,74 +90,83 @@ test_case::run() // ************** test_suite ************** // // ************************************************************************** // -struct test_suite::Impl { - std::list m_test_cases; - std::list::iterator m_curr_test_case; - counter_t m_cumulative_size; -}; - //____________________________________________________________________________// test_suite::test_suite( const_string name ) -: test_case( name, false, 0, false ), m_pimpl( new Impl ) +: test_unit( name, (test_unit_type)type ) { - m_pimpl->m_cumulative_size = 0; + framework::register_test_unit( this ); } //____________________________________________________________________________// -static void safe_delete_test_case( test_case* ptr ) { boost::checked_delete( ptr ); } - -test_suite::~test_suite() -{ - std::for_each( m_pimpl->m_test_cases.begin(), m_pimpl->m_test_cases.end(), &safe_delete_test_case ); -} - -//____________________________________________________________________________// +// !! need to prevent modifing test unit once it is added to tree void -test_suite::add( test_case* tc, counter_t exp_fail, int timeout ) +test_suite::add( test_unit* tu, counter_t expected_failures, unsigned timeout ) { - if( exp_fail != 0 ) { - tc->p_expected_failures.value = exp_fail; - } + if( expected_failures != 0 ) + tu->p_expected_failures.value = expected_failures; - p_expected_failures.value += tc->p_expected_failures; + p_expected_failures.value += tu->p_expected_failures; if( timeout != 0 ) - tc->p_timeout.value = timeout; + tu->p_timeout.value = timeout; - m_pimpl->m_test_cases.push_back( tc ); - m_pimpl->m_cumulative_size += tc->size(); - - p_stages_amount.value = p_stages_amount + 1; -} - -//____________________________________________________________________________// - -counter_t -test_suite::size() const -{ - return m_pimpl->m_cumulative_size; + m_members.push_back( tu->p_id ); } //____________________________________________________________________________// void -test_suite::do_init() +test_suite::add( test_unit_generator const& gen, unsigned timeout ) { - m_pimpl->m_curr_test_case = m_pimpl->m_test_cases.begin(); + test_unit* tu; + while( tu = gen.next() ) + add( tu, 0, timeout ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** traverse_test_tree ************** // +// ************************************************************************** // + +void +traverse_test_tree( test_case const& tc, test_tree_visitor& V ) +{ + V.visit( tc ); +} + +//____________________________________________________________________________// + +void traverse_test_tree( test_suite const& suite, test_tree_visitor& V ) +{ + if( !V.test_suite_start( suite ) ) + return; + + try { + // !!!! random + BOOST_TEST_FOREACH( test_unit_id, id, suite.m_members ) + traverse_test_tree( id, V ); + } catch( test_aborted const& ) { + V.test_suite_finish( suite ); + + throw; + } + + V.test_suite_finish( suite ); } //____________________________________________________________________________// void -test_suite::do_run() +traverse_test_tree( test_unit_id id, test_tree_visitor& V ) { - if( (*m_pimpl->m_curr_test_case)->size() > 1 ) - p_compound_stage.value = true; - (*m_pimpl->m_curr_test_case)->run(); - ++m_pimpl->m_curr_test_case; + if( test_id_2_unit_type( id ) == tut_case ) + traverse_test_tree( framework::get( id ), V ); + else + traverse_test_tree( framework::get( id ), V ); } //____________________________________________________________________________// @@ -302,36 +193,17 @@ normalize_test_case_name( const_string name ) } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : -// +// // $Log$ -// Revision 1.4 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.3 2005/01/30 01:52:47 rogeeff -// counter type renamed -// log interface functions shortened -// -// Revision 1.1 2005/01/22 19:22:13 rogeeff -// implementation moved into headers section to eliminate dependency of included/minimal component on src directory -// -// Revision 1.19 2005/01/21 07:26:41 rogeeff -// xml printing helpers reworked to employ generic custom manipulators -// -// Revision 1.17 2005/01/18 08:30:08 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// Revision 1.5 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_SUITE_IPP_012205GER +#endif // BOOST_TEST_UNIT_TEST_SUITE_IPP_012205GER diff --git a/include/boost/test/impl/xml_log_formatter.ipp b/include/boost/test/impl/xml_log_formatter.ipp index 1a425cb0..952f5dcc 100644 --- a/include/boost/test/impl/xml_log_formatter.ipp +++ b/include/boost/test/impl/xml_log_formatter.ipp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -9,7 +9,7 @@ // // Version : $Revision$ // -// Description : implements Unit Test Log formatters +// Description : implements XML Log formatter // *************************************************************************** #ifndef BOOST_TEST_XML_LOG_FORMATTER_IPP_020105GER @@ -18,6 +18,8 @@ // Boost.Test #include #include +#include +#include #include @@ -26,7 +28,10 @@ // STL #include -#include + +#include + +//____________________________________________________________________________// namespace boost { @@ -34,187 +39,144 @@ namespace unit_test { namespace output { +static const_string tu_type_name( test_unit const& tu ) +{ + return tu.p_type == tut_case ? "TestCase" : "TestSuite"; +} + // ************************************************************************** // // ************** xml_log_formatter ************** // // ************************************************************************** // -xml_log_formatter::xml_log_formatter() -: m_indent( 0 ) +void +xml_log_formatter::log_start( std::ostream& ostr, counter_t test_cases_amount ) { + ostr << ""; } //____________________________________________________________________________// void -xml_log_formatter::start_log( std::ostream& output, bool log_build_info ) +xml_log_formatter::log_finish( std::ostream& ostr ) { - output << "\n"; + ostr << ""; } //____________________________________________________________________________// void -xml_log_formatter::log_header( std::ostream& /* output */, counter_t /* test_cases_amount */ ) +xml_log_formatter::log_build_info( std::ostream& ostr ) { + ostr << ""; } //____________________________________________________________________________// void -xml_log_formatter::finish_log( std::ostream& output ) +xml_log_formatter::test_unit_start( std::ostream& ostr, test_unit const& tu ) { - output << "\n"; + ostr << "<" << tu_type_name( tu ) << " name" << attr_value() << tu.p_name << ">"; } //____________________________________________________________________________// void -xml_log_formatter::start_test_case( test_case const& tc ) +xml_log_formatter::test_unit_finish( std::ostream& ostr, test_unit const& tu, unsigned long elapsed ) { - m_curr_test_case_name = tc.p_name; + if( tu.p_type == tut_case ) + ostr << "" << elapsed << ""; + + ostr << ""; } //____________________________________________________________________________// void -xml_log_formatter::test_case_enter( std::ostream& output, test_case const& tc ) +xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu ) { - print_indent( output ); - - output << "<" << ( tc.p_type ? "TestCase" : "TestSuite" ) - << " name" << attr_value() << m_curr_test_case_name << ">"; - - m_indent += 2; + ostr << "<" << tu_type_name( tu ) + << " name" << attr_value() << tu.p_name + << " skipped" << attr_value() << "yes" + << "/>"; } - -//____________________________________________________________________________// - -void -xml_log_formatter::test_case_exit( std::ostream& output, test_case const& tc, long testing_time_in_mks ) -{ - print_indent( output ); - - output << "" << testing_time_in_mks << ""; - - m_indent -= 2; - - print_indent( output ); - - output << ""; -} - -//____________________________________________________________________________// - -void -xml_log_formatter::log_exception( std::ostream& output, log_checkpoint_data const& checkpoint_data, const_string explanation ) -{ - print_indent( output ); - output << "\n"; - m_indent += 2; +//____________________________________________________________________________// - print_indent( output ); - output << pcdata() << explanation << '\n'; +void +xml_log_formatter::log_exception( std::ostream& ostr, log_checkpoint_data const& checkpoint_data, const_string explanation ) +{ + ostr << "" + << pcdata() << explanation; if( !checkpoint_data.m_message.empty() ) { - print_indent( output ); - output << "\n"; - - m_indent += 2; - - print_indent( output ); - output << pcdata() << checkpoint_data.m_message << "\n"; - - m_indent -= 2; - - print_indent( output ); - output << "\n"; + ostr << "" + << pcdata() << checkpoint_data.m_message + << ""; } - m_indent -= 2; - print_indent( output ); - - output << ""; + ostr << ""; } //____________________________________________________________________________// void -xml_log_formatter::begin_log_entry( std::ostream& output, log_entry_data const& entry_data, log_entry_types let ) +xml_log_formatter::log_entry_start( std::ostream& ostr, log_entry_data const& entry_data, log_entry_types let ) { static literal_string xml_tags[] = { "Info", "Message", "Warning", "Error", "FatalError" }; - print_indent( output ); - m_curr_tag = xml_tags[let]; - output << '<' << m_curr_tag - << " file" << attr_value() << entry_data.m_file - << " line" << attr_value() << entry_data.m_line - << ">\n"; - - m_indent += 2; - print_indent( output ); + ostr << '<' << m_curr_tag + << " file" << attr_value() << entry_data.m_file + << " line" << attr_value() << entry_data.m_line + << ">"; } //____________________________________________________________________________// void -xml_log_formatter::log_entry_value( std::ostream& output, const_string value ) +xml_log_formatter::log_entry_value( std::ostream& ostr, const_string value ) { - output << pcdata() << value; + ostr << pcdata() << value; } //____________________________________________________________________________// void -xml_log_formatter::end_log_entry( std::ostream& output ) +xml_log_formatter::log_entry_finish( std::ostream& ostr ) { - if( m_curr_tag.is_empty() ) - return; - - output << '\n'; - - m_indent -= 2; - print_indent( output ); - - output << ""; + ostr << ""; m_curr_tag.clear(); } //____________________________________________________________________________// -void -xml_log_formatter::print_indent( std::ostream& output ) -{ - output << std::setw( m_indent ) << ""; -} - -//____________________________________________________________________________// - } // namespace output } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/02/01 08:59:38 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/impl/xml_report_formatter.ipp b/include/boost/test/impl/xml_report_formatter.ipp new file mode 100644 index 00000000..e1abcc02 --- /dev/null +++ b/include/boost/test/impl/xml_report_formatter.ipp @@ -0,0 +1,123 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : XML report formatter +// *************************************************************************** + +#ifndef BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER +#define BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER + +// Boost.Test +#include +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace output { + +void +xml_report_formatter::results_report_start( std::ostream& ostr ) +{ + ostr << ""; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::results_report_finish( std::ostream& ostr ) +{ + ostr << ""; +} + + +//____________________________________________________________________________// + +void +xml_report_formatter::test_unit_report_start( test_unit const& tu, std::ostream& ostr ) +{ + test_results const& tr = results_collector.results( tu.p_id ); + + const_string descr; + + if( tr.passed() ) + descr = "passed"; + else if( tr.p_skipped ) + descr = "skipped"; + else if( tr.p_aborted ) + descr = "aborted"; + else + descr = "failed"; + + ostr << '<' << ( tu.p_type == tut_case ? "TestCase" : "TestSuite" ) + << " name" << attr_value() << tu.p_name + << " result" << attr_value() << descr + << " assertions_passed" << attr_value() << tr.p_assertions_passed + << " assertions_failed" << attr_value() << tr.p_assertions_failed + << " expected_failures" << attr_value() << tr.p_expected_failures; + + if( tu.p_type == tut_suite ) + ostr << " test_cases_passed" << attr_value() << tr.p_test_cases_passed + << " test_cases_failed" << attr_value() << tr.p_test_cases_failed + << " test_cases_skipped" << attr_value() << tr.p_test_cases_skipped; + + + ostr << '>'; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::test_unit_report_finish( test_unit const& tu, std::ostream& ostr ) +{ + ostr << "'; +} + +//____________________________________________________________________________// + +void +xml_report_formatter::do_confirmation_report( test_unit const& tu, std::ostream& ostr ) +{ + test_unit_report_start( tu, ostr ); + test_unit_report_finish( tu, ostr ); +} + +//____________________________________________________________________________// + +} // namespace output + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:07 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_XML_REPORT_FORMATTER_IPP_020105GER diff --git a/include/boost/test/included/test_exec_monitor.hpp b/include/boost/test/included/test_exec_monitor.hpp index 3d60644f..76c2d754 100644 --- a/include/boost/test/included/test_exec_monitor.hpp +++ b/include/boost/test/included/test_exec_monitor.hpp @@ -15,25 +15,30 @@ #ifndef BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER #define BOOST_INCLUDED_TEST_EXEC_MONITOR_HPP_071894GER -#include //!! for borland workaround -#include - -#include - -#include -#include -#include -#include -#include #include -#include - +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.13 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.12 2005/02/01 08:59:38 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/included/unit_test_framework.hpp b/include/boost/test/included/unit_test_framework.hpp index 0cf8a4ed..6d5cce2f 100644 --- a/include/boost/test/included/unit_test_framework.hpp +++ b/include/boost/test/included/unit_test_framework.hpp @@ -9,30 +9,35 @@ // // Version : $Revision$ // -// Description : included (vs. linked ) version of Unit Test Framework +// Description : included (vs. linked) version of Unit Test Framework // *************************************************************************** #ifndef BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER #define BOOST_INCLUDED_UNIT_TEST_FRAMEWORK_HPP_071894GER -#include - -#include - -#include -#include -#include -#include -#include #include -#include - +#include +#include +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.13 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.12 2005/02/01 08:59:38 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/minimal.hpp b/include/boost/test/minimal.hpp index 8c20c9bc..bfff05b0 100644 --- a/include/boost/test/minimal.hpp +++ b/include/boost/test/minimal.hpp @@ -18,77 +18,80 @@ #define BOOST_CHECK(exp) \ ( (exp) \ ? static_cast(0) \ - : boost::minimal_test::the_monitor->report_error(#exp,__FILE__,__LINE__, BOOST_CURRENT_FUNCTION) ) + : boost::minimal_test::report_error(#exp,__FILE__,__LINE__, BOOST_CURRENT_FUNCTION) ) #define BOOST_REQUIRE(exp) \ ( (exp) \ ? static_cast(0) \ - : boost::minimal_test::the_monitor->report_critical_error(#exp,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)) + : boost::minimal_test::report_critical_error(#exp,__FILE__,__LINE__,BOOST_CURRENT_FUNCTION)) #define BOOST_ERROR( msg_ ) \ - boost::minimal_test::the_monitor->report_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) + boost::minimal_test::report_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) #define BOOST_FAIL( msg_ ) \ - boost::minimal_test::the_monitor->report_critical_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) + boost::minimal_test::report_critical_error( (msg_),__FILE__,__LINE__, BOOST_CURRENT_FUNCTION, true ) //____________________________________________________________________________// // Boost.Test +#include #include #include +#include // Boost -#include // for exit codes +#include // for exit codes#include // for exit codes #include // for BOOST_CURRENT_FUNCTION // STL #include // std::cerr, std::endl #include // std::string +#include + //____________________________________________________________________________// -int test_main( int argc, char* argv[] ); // prototype for user's test_main() +int test_main( int argc, char* argv[] ); // prototype for users test_main() namespace boost { namespace minimal_test { typedef boost::unit_test::const_string const_string; -class monitor : public boost::execution_monitor { +inline unit_test::counter_t& errors_counter() { static unit_test::counter_t ec = 0; return ec; } + +inline void +report_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) +{ + ++errors_counter(); + std::cerr << file << "(" << line << "): "; + + if( is_msg ) + std::cerr << msg; + else + std::cerr << "test " << msg << " failed"; + + if( func_name != "(unknown)" ) + std::cerr << " in function: '" << func_name << "'"; + + std::cerr << std::endl; +} + +inline void +report_critical_error( const char* msg, const char* file, int line, const_string func_name, bool is_msg = false ) +{ + report_error( msg, file, line, func_name, is_msg ); + + throw boost::execution_aborted(); +} + +class caller { public: // constructor - monitor( int argc, char** argv ) - : p_errors_counter( 0 ), m_argc( argc ), m_argv( argv ) {} + caller( int argc, char** argv ) + : m_argc( argc ), m_argv( argv ) {} // execution monitor hook implementation - virtual int function() - { - return test_main( m_argc, m_argv ); - } - - void report_error( const char* msg_, const char* file_, int line_, const_string func_name_, bool is_msg_ = false ) - { - ++p_errors_counter.value; - std::cerr << file_ << "(" << line_ << "): "; - - if( is_msg_ ) - std::cerr << msg_; - else - std::cerr << "test " << msg_ << " failed"; - - if( func_name_ != "(unknown)" ) - std::cerr << " in function: '" << func_name_ << "'"; - - std::cerr << std::endl; - } - - void report_critical_error( const char* msg_, const char* file_, int line_, const_string func_name_, bool is_msg_ = false ) - { - report_error( msg_, file_, line_, func_name_, is_msg_ ); - throw boost::execution_exception( boost::execution_exception::no_error, "" ); - } - - // public properties - BOOST_READONLY_PROPERTY( int, ( monitor ) ) p_errors_counter; + int operator()() { return test_main( m_argc, m_argv ); } private: // Data members @@ -96,21 +99,19 @@ private: char** m_argv; }; // monitor -monitor* the_monitor; - } // namespace minimal_test + } // namespace boost //____________________________________________________________________________// int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) { - using boost::minimal_test::the_monitor; - - the_monitor = new boost::minimal_test::monitor( argc, argv ); + using namespace boost::minimal_test; try { - int run_result = boost::minimal_test::the_monitor->execute(); + ::boost::execution_monitor ex_mon; + int run_result = ex_mon.execute( caller( argc, argv ) ); BOOST_CHECK( run_result == 0 || run_result == boost::exit_success ); } @@ -122,24 +123,29 @@ int BOOST_TEST_CALL_DECL main( int argc, char* argv[] ) std::cerr << "\n**** Testing aborted."; } - if( boost::minimal_test::the_monitor->p_errors_counter != 0 ) { - std::cerr << "\n**** " << the_monitor->p_errors_counter.get() - << " error" << (the_monitor->p_errors_counter > 1 ? "s" : "" ) << " detected\n"; + if( boost::minimal_test::errors_counter() != 0 ) { + std::cerr << "\n**** " << errors_counter() + << " error" << (errors_counter() > 1 ? "s" : "" ) << " detected\n"; - delete the_monitor; return boost::exit_test_failure; } std::cout << "\n**** no errors detected\n"; - delete the_monitor; return boost::exit_success; } +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.19 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.18 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/output/compiler_log_formatter.hpp b/include/boost/test/output/compiler_log_formatter.hpp index 9687c983..da548551 100644 --- a/include/boost/test/output/compiler_log_formatter.hpp +++ b/include/boost/test/output/compiler_log_formatter.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -9,17 +9,20 @@ // // Version : $Revision$ // -// Description : contains compiler like log formatter definition +// Description : contains compiler like Log formatter definition // *************************************************************************** #ifndef BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER #define BOOST_TEST_COMPILER_LOG_FORMATTER_HPP_020105GER // Boost.Test +#include #include #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -32,25 +35,23 @@ namespace output { class compiler_log_formatter : public unit_test_log_formatter { public: - void start_log( std::ostream&, bool log_build_info ); - void log_header( std::ostream&, counter_t test_cases_amount ); - void finish_log( std::ostream& ); + // Formatter interface + void log_start( std::ostream&, counter_t test_cases_amount ); + void log_finish( std::ostream& ); + void log_build_info( std::ostream& ); - void start_test_case( test_case const& tc ); - void test_case_enter( std::ostream&, test_case const& tc ); - void test_case_exit( std::ostream&, test_case const& tc, long testing_time_in_mks ); + void test_unit_start( std::ostream&, test_unit const& tu ); + void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); + void test_unit_skipped( std::ostream&, test_unit const& tu ); void log_exception( std::ostream&, log_checkpoint_data const&, const_string explanation ); - void begin_log_entry( std::ostream&, log_entry_data const&, log_entry_types let ); + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); void log_entry_value( std::ostream&, const_string value ); - void end_log_entry( std::ostream& ); + void log_entry_finish( std::ostream& ); protected: virtual void print_prefix( std::ostream&, const_string file, std::size_t line ); - - // data members - const_string m_curr_test_case_name; }; } // namespace output @@ -59,12 +60,17 @@ protected: } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/02/01 08:59:39 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/output/plain_report_formatter.hpp b/include/boost/test/output/plain_report_formatter.hpp new file mode 100644 index 00000000..70493415 --- /dev/null +++ b/include/boost/test/output/plain_report_formatter.hpp @@ -0,0 +1,71 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : plain report formatter implementation +// *************************************************************************** + +#ifndef BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER +#define BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace output { + +// ************************************************************************** // +// ************** plain_report_formatter ************** // +// ************************************************************************** // + +class plain_report_formatter : public results_reporter::format { +public: + // Formatter interface + void results_report_start( std::ostream& ostr ); + void results_report_finish( std::ostream& ostr ); + + void test_unit_report_start( test_unit const&, std::ostream& ostr ); + void test_unit_report_finish( test_unit const&, std::ostream& ostr ); + + void do_confirmation_report( test_unit const&, std::ostream& ostr ); + +private: + // Data members + counter_t m_indent; +}; + +} // namespace output + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_PLAIN_REPORT_FORMATTER_HPP_020105GER diff --git a/include/boost/test/output/xml_log_formatter.hpp b/include/boost/test/output/xml_log_formatter.hpp index f3c044b9..fec71c98 100644 --- a/include/boost/test/output/xml_log_formatter.hpp +++ b/include/boost/test/output/xml_log_formatter.hpp @@ -1,4 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -9,13 +9,14 @@ // // Version : $Revision$ // -// Description : contains xml log formatter definition +// Description : contains XML Log formatter definition // *************************************************************************** #ifndef BOOST_TEST_XML_LOG_FORMATTER_020105GER #define BOOST_TEST_XML_LOG_FORMATTER_020105GER // Boost.Test +#include #include // STL @@ -23,6 +24,8 @@ #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -35,29 +38,24 @@ namespace output { class xml_log_formatter : public unit_test_log_formatter { public: - xml_log_formatter(); + // Formatter interface + void log_start( std::ostream&, counter_t test_cases_amount ); + void log_finish( std::ostream& ); + void log_build_info( std::ostream& ); - void start_log( std::ostream&, bool log_build_info ); - void log_header( std::ostream&, counter_t test_cases_amount ); - void finish_log( std::ostream& ); - - void start_test_case( test_case const& tc ); - void test_case_enter( std::ostream&, test_case const& tc ); - void test_case_exit( std::ostream&, test_case const& tc, long testing_time_in_mks ); + void test_unit_start( std::ostream&, test_unit const& tu ); + void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ); + void test_unit_skipped( std::ostream&, test_unit const& tu ); void log_exception( std::ostream&, log_checkpoint_data const&, const_string explanation ); - void begin_log_entry( std::ostream&, log_entry_data const&, log_entry_types let ); + void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ); void log_entry_value( std::ostream&, const_string value ); - void end_log_entry( std::ostream& ); + void log_entry_finish( std::ostream& ); private: - void print_indent( std::ostream& ); - // Data members - std::size_t m_indent; const_string m_curr_tag; - const_string m_curr_test_case_name; }; } // namespace output @@ -66,12 +64,17 @@ private: } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/02/01 08:59:39 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/output/xml_report_formatter.hpp b/include/boost/test/output/xml_report_formatter.hpp new file mode 100644 index 00000000..d25ebb00 --- /dev/null +++ b/include/boost/test/output/xml_report_formatter.hpp @@ -0,0 +1,67 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : XML report formatter implementation +// *************************************************************************** + +#ifndef BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER +#define BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace output { + +// ************************************************************************** // +// ************** xml_report_formatter ************** // +// ************************************************************************** // + +class xml_report_formatter : public results_reporter::format { +public: + // Formatter interface + void results_report_start( std::ostream& ostr ); + void results_report_finish( std::ostream& ostr ); + + void test_unit_report_start( test_unit const&, std::ostream& ostr ); + void test_unit_report_finish( test_unit const&, std::ostream& ostr ); + + void do_confirmation_report( test_unit const&, std::ostream& ostr ); +}; + +} // namespace output + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_XML_REPORT_FORMATTER_HPP_020105GER diff --git a/include/boost/test/output_test_stream.hpp b/include/boost/test/output_test_stream.hpp index 6ead7839..221e43d1 100644 --- a/include/boost/test/output_test_stream.hpp +++ b/include/boost/test/output_test_stream.hpp @@ -16,18 +16,17 @@ #define BOOST_TEST_OUTPUT_TEST_STREAM_HPP_012705GER // Boost.Test -#include +#include #include - -// Boost -#include // compilers workarounds -#include +#include // STL #include // for std::size_t #include +//____________________________________________________________________________// + // ************************************************************************** // // ************** output_test_stream ************** // // ************************************************************************** // @@ -40,8 +39,8 @@ namespace test_tools { class output_test_stream : public wrap_stringstream::wrapped_stream { - typedef boost::unit_test::const_string const_string; - typedef predicate_result result_type; + typedef unit_test::const_string const_string; + typedef predicate_result result_type; public: // Constructor explicit output_test_stream( const_string pattern_file_name = const_string(), @@ -51,10 +50,10 @@ public: ~output_test_stream(); // checking function - result_type is_empty( bool flush_stream_ = true ); - result_type check_length( std::size_t length_, bool flush_stream_ = true ); - result_type is_equal( const_string arg_, bool flush_stream_ = true ); - result_type match_pattern( bool flush_stream_ = true ); + result_type is_empty( bool flush_stream = true ); + result_type check_length( std::size_t length, bool flush_stream = true ); + result_type is_equal( const_string arg_, bool flush_stream = true ); + result_type match_pattern( bool flush_stream = true ); // explicit flush void flush(); @@ -72,12 +71,17 @@ private: } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.3 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.2 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/parameterized_test.hpp b/include/boost/test/parameterized_test.hpp new file mode 100644 index 00000000..380a9b8b --- /dev/null +++ b/include/boost/test/parameterized_test.hpp @@ -0,0 +1,146 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : generators and helper macros for parameterized tests +// *************************************************************************** + +#ifndef BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER +#define BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER + +// Boost.Test +#include +#include + +// Boost +#include + +#include + +//____________________________________________________________________________// + +#define BOOST_PARAM_TEST_CASE( function, begin, end ) \ +boost::unit_test::make_test_case( function, \ + BOOST_TEST_STRINGIZE( function ), \ + (begin), (end) ) \ +/**/ + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** test_func_with_bound_param ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct test_func_with_bound_param { + template + test_func_with_bound_param( callback1 test_func, T const& param ) + : m_test_func( test_func ) + , m_param( param ) + {} + + void operator()() { m_test_func( m_param ); } + +private: + callback1 m_test_func; + ParamType m_param; +}; + +// ************************************************************************** // +// ************** param_test_case_generator ************** // +// ************************************************************************** // + +template +class param_test_case_generator : public test_unit_generator { +public: + param_test_case_generator( callback1 const& test_func, + const_string tc_name, + ParamIter par_begin, + ParamIter par_end ) + : m_test_func( test_func ) + , m_tc_name( ut_detail::normalize_test_case_name( tc_name ) ) + , m_par_begin( par_begin ) + , m_par_end( par_end ) + {} + + test_unit* next() const + { + if( m_par_begin == m_par_end ) + return (test_unit*)0; + + test_func_with_bound_param bound_test_func( m_test_func, *m_par_begin ); + 0; // !! MSVC bug + test_unit* res = new test_case( m_tc_name, bound_test_func ); + + ++m_par_begin; + + return res; + } + +private: + // Data members + callback1 m_test_func; + std::string m_tc_name; + mutable ParamIter m_par_begin; + ParamIter m_par_end; +}; + +//____________________________________________________________________________// + +} // namespace ut_detail + +template +inline ut_detail::param_test_case_generator +make_test_case( callback1 const& test_func, + const_string tc_name, + ParamIter par_begin, + ParamIter par_end ) +{ + return ut_detail::param_test_case_generator( test_func, tc_name, par_begin, par_end ); +} + +//____________________________________________________________________________// + +template +inline ut_detail::param_test_case_generator::type,ParamIter> +make_test_case( void (*test_func)( ParamType ), + const_string tc_name, + ParamIter par_begin, + ParamIter par_end ) +{ + typedef typename remove_reference::type param_value_type; + return ut_detail::param_test_case_generator( test_func, tc_name, par_begin, par_end ); +} + +//____________________________________________________________________________// + +} // unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_PARAMETERIZED_TEST_HPP_021102GER + diff --git a/include/boost/test/predicate_result.hpp b/include/boost/test/predicate_result.hpp index d5b54e6b..a6816ec0 100644 --- a/include/boost/test/predicate_result.hpp +++ b/include/boost/test/predicate_result.hpp @@ -18,15 +18,19 @@ // Boost.Test #include #include +#include // Boost #include +#include // STL #include // for std::size_t #include +//____________________________________________________________________________// + namespace boost { namespace test_tools { @@ -36,7 +40,7 @@ namespace test_tools { // ************************************************************************** // class predicate_result { - typedef boost::unit_test::const_string const_string; + typedef unit_test::const_string const_string; public: // Constructor predicate_result( bool pv_ ) @@ -80,7 +84,7 @@ private: wrap_stringstream* m_message; #else // Data members - boost::shared_ptr m_message; + shared_ptr m_message; #endif }; @@ -88,12 +92,17 @@ private: } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/03 20:39:12 rogeeff // m_message zero init for sunpro // diff --git a/include/boost/test/progress_monitor.hpp b/include/boost/test/progress_monitor.hpp new file mode 100644 index 00000000..3703b435 --- /dev/null +++ b/include/boost/test/progress_monitor.hpp @@ -0,0 +1,76 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines simple text based progress monitor +// *************************************************************************** + +#ifndef BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER +#define BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER + +// Boost.Test +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** progress_monitor ************** // +// ************************************************************************** // + +class progress_monitor_t : public test_observer, public singleton { +public: + // test observer interface + void test_start( counter_t test_cases_amount ); + void test_finish() {} + void test_aborted(); + + void test_unit_start( test_unit const& ) {} + void test_unit_finish( test_unit const&, unsigned long ); + void test_unit_skipped( test_unit const& ); + void test_unit_aborted( test_unit const& ) {} + + void assertion_result( bool passed ) {} + void exception_caught( execution_exception const& ) {} + + // configuration + void set_stream( std::ostream& ); + +private: + BOOST_TEST_SINGLETON_CONS( progress_monitor_t ); +}; // progress_monitor_t + +BOOST_TEST_SINGLETON_INST( progress_monitor ) + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_PROGRESS_MONITOR_HPP_020105GER + diff --git a/include/boost/test/results_collector.hpp b/include/boost/test/results_collector.hpp new file mode 100644 index 00000000..99b2df4d --- /dev/null +++ b/include/boost/test/results_collector.hpp @@ -0,0 +1,134 @@ +// (C) Copyright Gennadiy Rozental 2001-2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines class unit_test_result that is responsible for +// gathering test results and presenting this information to end-user +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER +#define BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER + +// Boost.Test +#include + +#include +#include + +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** first failed assertion debugger hook ************** // +// ************************************************************************** // + +namespace { +inline void first_failed_assertion() {} +} + +// ************************************************************************** // +// ************** test_results ************** // +// ************************************************************************** // + +class test_results { +public: + test_results(); + + typedef BOOST_READONLY_PROPERTY( counter_t, (results_collector_t)(test_results)(results_collect_helper) ) counter_prop; + typedef BOOST_READONLY_PROPERTY( bool, (results_collector_t)(test_results)(results_collect_helper) ) bool_prop; + + counter_prop p_assertions_passed; + counter_prop p_assertions_failed; + counter_prop p_expected_failures; + counter_prop p_test_cases_passed; + counter_prop p_test_cases_failed; + counter_prop p_test_cases_skipped; + bool_prop p_aborted; + bool_prop p_skipped; + + // "conclusion" methods + bool passed() const; + int result_code() const; + + // collection helper + void operator+=( test_results const& ); + + void clear(); +}; + +// ************************************************************************** // +// ************** results_collector ************** // +// ************************************************************************** // + +class results_collector_t : public test_observer, public singleton { +public: + // test_observer interface implementation + void test_start( counter_t test_cases_amount ); + void test_finish(); + void test_aborted(); + + void test_unit_start( test_unit const& ); + void test_unit_finish( test_unit const&, unsigned long elapsed ); + void test_unit_skipped( test_unit const& ); + void test_unit_aborted( test_unit const& ); + + void assertion_result( bool passed ); + void exception_caught( execution_exception const& ); + + // results access + test_results const& results( test_unit_id ) const; + +private: + BOOST_TEST_SINGLETON_CONS( results_collector_t ); +}; + +BOOST_TEST_SINGLETON_INST( results_collector ) + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// Revision 1.25 2005/02/01 08:59:29 rogeeff +// supplied_log_formatters split +// change formatters interface to simplify result interface +// +// Revision 1.24 2005/02/01 06:40:06 rogeeff +// copyright update +// old log entries removed +// minor stilistic changes +// depricated tools removed +// +// Revision 1.23 2005/01/30 03:23:06 rogeeff +// result_tracker class removed +// counter type renamed +// +// *************************************************************************** + +#endif // BOOST_TEST_RESULTS_COLLECTOR_HPP_071894GER + diff --git a/include/boost/test/results_reporter.hpp b/include/boost/test/results_reporter.hpp new file mode 100644 index 00000000..77f36a4c --- /dev/null +++ b/include/boost/test/results_reporter.hpp @@ -0,0 +1,92 @@ +// (C) Copyright Gennadiy Rozental 2001-2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines class unit_test_result that is responsible for +// gathering test results and presenting this information to end-user +// *************************************************************************** + +#ifndef BOOST_TEST_RESULTS_REPORTER_HPP_021205GER +#define BOOST_TEST_RESULTS_REPORTER_HPP_021205GER + +// Boost.Test +#include +#include + +// STL +#include // for std::ostream& + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace results_reporter { + +// ************************************************************************** // +// ************** formatter interface ************** // +// ************************************************************************** // + +class format { +public: + // Destructor + virtual ~format() {} + + virtual void results_report_start( std::ostream& ostr ) = 0; + virtual void results_report_finish( std::ostream& ostr ) = 0; + + virtual void test_unit_report_start( test_unit const&, std::ostream& ostr ) = 0; + virtual void test_unit_report_finish( test_unit const&, std::ostream& ostr ) = 0; + + virtual void do_confirmation_report( test_unit const&, std::ostream& ostr ) = 0; +}; + +// ************************************************************************** // +// ************** report configuration ************** // +// ************************************************************************** // + +void set_level( report_level ); +void set_stream( std::ostream& ); +void set_format( output_format ); +void set_format( results_reporter::format* ); + +// ************************************************************************** // +// ************** report initiation ************** // +// ************************************************************************** // + +void make_report( report_level l = INV_REPORT_LEVEL, test_unit_id = INV_TEST_UNIT_ID ); +inline void confirmation_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( CONFIRMATION_REPORT, id ); } +inline void short_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( SHORT_REPORT, id ); } +inline void detailed_report( test_unit_id id = INV_TEST_UNIT_ID ) { make_report( DETAILED_REPORT, id ); } + +} // namespace results_reporter + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_RESULTS_REPORTER_HPP_021205GER + diff --git a/include/boost/test/test_case_template.hpp b/include/boost/test/test_case_template.hpp index 940171a4..4f6f3cc4 100644 --- a/include/boost/test/test_case_template.hpp +++ b/include/boost/test/test_case_template.hpp @@ -13,127 +13,150 @@ // sequence of test types // *************************************************************************** -#ifndef BOOST_TEST_CASE_TEMPLATE_HPP_071894GER -#define BOOST_TEST_CASE_TEMPLATE_HPP_071894GER +#ifndef BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER +#define BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER // Boost.Test #include // Boost -#include "boost/mpl/size.hpp" #include #include +#include +#include + +// STL +#include + +#include //____________________________________________________________________________// -#define BOOST_META_FUNC_TEST_CASE( the_function ) \ -struct BOOST_JOIN( meta_, the_function ) { \ - template \ - static void execute( T* = 0 ) \ - { \ - the_function(); \ - } \ -} \ +#define BOOST_TEST_CASE_TEMPLATE( name, typelist ) \ + boost::unit_test::ut_detail::template_test_case_gen( \ + BOOST_TEST_STRINGIZE( name ) ) \ /**/ -#define BOOST_FUNC_TEMPLATE_TEST_CASE( the_function, typelist ) \ -boost::unit_test::create_test_case_template( BOOST_JOIN( meta_, the_function )(), typelist(), BOOST_TEST_STRINGIZE( the_function ) ) - +//____________________________________________________________________________// + +#define BOOST_TEST_CASE_TEMPLATE_FUNCTION( name, type_name ) \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ); \ + \ +struct name { \ + template \ + static void run( boost::type* frwrd = 0 ) \ + { \ + BOOST_JOIN( name, _impl )( frwrd ); \ + } \ +}; \ + \ +template \ +void BOOST_JOIN( name, _impl )( boost::type* ) \ +/**/ + +//____________________________________________________________________________// + namespace boost { + namespace unit_test { + namespace ut_detail { // ************************************************************************** // -// ************** test_case_template_instance ************** // +// ************** test_case_template_invoker ************** // // ************************************************************************** // -// Generate test case by supplied test case template and test type template -class test_case_template_instance : public test_case { - typedef TestType* test_type_ptr; +class test_case_template_invoker { public: - explicit test_case_template_instance( const_string template_name_ ) - : test_case( template_name_, true, 1 ) {} - -protected: - // test case implementation - void do_run() { TestCaseTemplate::execute( test_type_ptr() ); } - + void operator()() { TestCaseTemplate::template run(); } }; //____________________________________________________________________________// // ************************************************************************** // -// ************** test_case_instance_runner ************** // +// ************** generate_test_case_4_type ************** // // ************************************************************************** // -// Instantiate generated test case and run it. -template -struct test_case_instance_runner { - explicit test_case_instance_runner( const_string template_name_ ) - : m_template_name( template_name_ ) {} +template +struct generate_test_case_4_type { + explicit generate_test_case_4_type( const_string tc_name, Generator& G ) + : m_test_case_name( tc_name ) + , m_holder( G ) + {} template - void operator()( ::boost::mpl::identity ) + void operator()( mpl::identity ) { - test_case_template_instance the_instance( m_template_name ); //!! could this throw? + std::string full_name; + m_test_case_name.assign_to( full_name ); + full_name += '<'; + full_name += typeid(TestType).name(); + if( boost::is_const::value ) + full_name += " const"; + full_name += '>'; - the_instance.run(); + m_holder.m_test_cases.push_back( + new test_case( full_name, test_case_template_invoker() ) ); } - const_string m_template_name; +private: + // Data members + const_string m_test_case_name; + Generator& m_holder; }; -} // namespace ut_detail - // ************************************************************************** // // ************** test_case_template ************** // // ************************************************************************** // template -class test_case_template : public test_case { +class template_test_case_gen : public test_unit_generator { public: // Constructor - explicit test_case_template( const_string name_ ) - : test_case( name_, false, 1, false ), m_template_holder( p_name.get() ) {} - - // access methods - counter_t size() const { return ::boost::mpl::size::value; } - -protected: - - // test case implementation - void do_run() + template_test_case_gen( const_string tc_name ) { - ::boost::mpl::for_each >( m_template_holder ); + typedef generate_test_case_4_type, + TestCaseTemplate + > single_test_gen; + mpl::for_each >( single_test_gen( tc_name, *this ) ); + } + + test_unit* next() const + { + if( m_test_cases.empty() ) + return 0; + + test_unit* res = m_test_cases.front(); + m_test_cases.pop_front(); + + return res; } // Data members - ut_detail::test_case_instance_runner m_template_holder; // need instance to match for_each interface + mutable std::list m_test_cases; }; //____________________________________________________________________________// -// ************************************************************************** // -// ************** object generators ************** // -// ************************************************************************** // +} // namespace ut_detail -template -inline test_case* -create_test_case_template( TestCaseTemplate, TestTypesList, const_string name_ ) -{ - return new test_case_template( ut_detail::normalize_test_case_name( name_ ) ); -} +} // unit_test + +} // namespace boost //____________________________________________________________________________// -} // unit_test -} // namespace boost +#include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.11 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.10 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed @@ -145,5 +168,5 @@ create_test_case_template( TestCaseTemplate, TestTypesList, const_string name_ ) // // *************************************************************************** -#endif // BOOST_TEST_CASE_TEMPLATE_HPP_071894GER +#endif // BOOST_TEST_TEST_CASE_TEMPLATE_HPP_071894GER diff --git a/include/boost/test/test_observer.hpp b/include/boost/test/test_observer.hpp new file mode 100644 index 00000000..85f27e91 --- /dev/null +++ b/include/boost/test/test_observer.hpp @@ -0,0 +1,72 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : defines abstract interface for test observer +// *************************************************************************** + +#ifndef BOOST_TEST_TEST_OBSERVER_HPP_021005GER +#define BOOST_TEST_TEST_OBSERVER_HPP_021005GER + +// Boost.Test +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** test_observer ************** // +// ************************************************************************** // + +class test_observer { +public: + // test observer interface + virtual void test_start( counter_t test_cases_amount ) = 0; + virtual void test_finish() = 0; + virtual void test_aborted() = 0; + + virtual void test_unit_start( test_unit const& ) = 0; + virtual void test_unit_finish( test_unit const&, unsigned long elapsed ) = 0; + virtual void test_unit_skipped( test_unit const& ) = 0; + virtual void test_unit_aborted( test_unit const& ) = 0; + + virtual void assertion_result( bool passed ) = 0; + virtual void exception_caught( execution_exception const& ) = 0; + +protected: + BOOST_TEST_PROTECTED_VIRTUAL ~test_observer() {} +}; + +} // unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_TEST_OBSERVER_HPP_021005GER + diff --git a/include/boost/test/test_tools.hpp b/include/boost/test/test_tools.hpp index 9ac355ae..c00c0e6d 100644 --- a/include/boost/test/test_tools.hpp +++ b/include/boost/test/test_tools.hpp @@ -12,26 +12,31 @@ // Description : contains definition for all test tools in test toolbox // *************************************************************************** -#ifndef BOOST_TEST_TOOLS_HPP_012705GER -#define BOOST_TEST_TOOLS_HPP_012705GER +#ifndef BOOST_TEST_TEST_TOOLS_HPP_012705GER +#define BOOST_TEST_TEST_TOOLS_HPP_012705GER // Boost.Test -#include -#include #include +#include +#include + +#include +#include + // Boost #include #include #include // STL -#include // for std::exception #include // for std::size_t #include #include +//____________________________________________________________________________// + // ************************************************************************** // // ************** TOOL BOX ************** // // ************************************************************************** // @@ -51,7 +56,7 @@ boost::test_tools::tt_detail::check_impl( \ P, \ boost::wrap_stringstream().ref() << check_descr, \ - BOOST_TEST_STRING_LITERAL(__FILE__), \ + BOOST_TEST_L(__FILE__), \ (std::size_t)__LINE__, \ boost::test_tools::tt_detail::TL, \ boost::test_tools::tt_detail::CT \ @@ -214,7 +219,7 @@ namespace boost { namespace test_tools { -typedef boost::unit_test::const_string const_string; +typedef unit_test::const_string const_string; namespace tt_detail { @@ -238,13 +243,6 @@ enum tool_level { WARN, CHECK, REQUIRE, PASS }; -// ************************************************************************** // -// ************** test_tool_failed ************** // -// ************************************************************************** // - -// Exception to be used to report critical tools failures -struct test_tool_failed : public std::exception {}; - // ************************************************************************** // // ************** log print helper ************** // // ************************************************************************** // @@ -433,16 +431,19 @@ bool is_defined_impl( const_string symbol_name_, const_string symbol_value_ ); } // namespace test_tools -namespace test_toolbox = test_tools; - } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.50 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.49 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed @@ -462,4 +463,4 @@ namespace test_toolbox = test_tools; // // *************************************************************************** -#endif // BOOST_TEST_TOOLS_HPP_012705GER +#endif // BOOST_TEST_TEST_TOOLS_HPP_012705GER diff --git a/include/boost/test/unit_test.hpp b/include/boost/test/unit_test.hpp index 9284a7bb..c8c592b2 100644 --- a/include/boost/test/unit_test.hpp +++ b/include/boost/test/unit_test.hpp @@ -12,8 +12,8 @@ // Description : wrapper include . To be used by end-user // *************************************************************************** -#ifndef BOOST_UNIT_TEST_HPP_071894GER -#define BOOST_UNIT_TEST_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_HPP_071894GER #include #include @@ -32,6 +32,9 @@ // Revision History : // // $Log$ +// Revision 1.15 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.14 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed @@ -40,4 +43,4 @@ // // *************************************************************************** -#endif // BOOST_UNIT_TEST_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_HPP_071894GER diff --git a/include/boost/test/unit_test_log.hpp b/include/boost/test/unit_test_log.hpp index d7bde712..345fa42d 100644 --- a/include/boost/test/unit_test_log.hpp +++ b/include/boost/test/unit_test_log.hpp @@ -14,13 +14,17 @@ // completely hidden with pimple idiom // *************************************************************************** -#ifndef BOOST_UNIT_TEST_LOG_HPP_071894GER -#define BOOST_UNIT_TEST_LOG_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER // Boost.Test -#include +#include + +#include #include -#include +#include + +#include // Boost #include @@ -30,6 +34,8 @@ #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -45,19 +51,19 @@ struct begin {}; struct end {}; struct line { - explicit line( std::size_t ln_ ) : m_line_num( ln_ ) {} + explicit line( std::size_t ln ) : m_line_num( ln ) {} std::size_t m_line_num; }; struct file { - explicit file( const_string fn_ ) : m_file_name( fn_ ) {} + explicit file( const_string fn ) : m_file_name( fn ) {} const_string m_file_name; }; struct checkpoint { - explicit checkpoint( const_string message_ ) : m_message( message_ ) {} + explicit checkpoint( const_string message ) : m_message( message ) {} const_string m_message; }; @@ -92,66 +98,66 @@ private: // ************** unit_test_log ************** // // ************************************************************************** // -class unit_test_log_t : private boost::noncopyable { +class unit_test_log_t : public test_observer, public singleton { public: - // instance access method; - static unit_test_log_t& instance(); + // test_observer interface implementation + void test_start( counter_t test_cases_amount ); + void test_finish(); + void test_aborted(); - void start( bool log_build_info = false ); - void header( counter_t ); - void finish( counter_t ); + void test_unit_start( test_unit const& ); + void test_unit_finish( test_unit const&, unsigned long elapsed ); + void test_unit_skipped( test_unit const& ); + void test_unit_aborted( test_unit const& ); + + void assertion_result( bool passed ); + void exception_caught( execution_exception const& ); // log configuration methods void set_stream( std::ostream& ); void set_threshold_level( log_level ); - void set_threshold_level_by_name( const_string ); - void set_format( const_string ); + void set_format( output_format ); void set_formatter( unit_test_log_formatter* ); - // test case scope tracking - void test_case_enter( test_case const& ); - void test_case_exit( test_case const&, long testing_time_in_mks ); + // entry logging + unit_test_log_t& operator<<( log::begin const& ); // begin entry + unit_test_log_t& operator<<( log::end const& ); // end entry + unit_test_log_t& operator<<( log::file const& ); // set entry file name + unit_test_log_t& operator<<( log::line const& ); // set entry line number + unit_test_log_t& operator<<( log::checkpoint const& ); // set checkpoint + unit_test_log_t& operator<<( log_level ); // set entry level + unit_test_log_t& operator<<( const_string ); // log entry value - // entry setup - unit_test_log_t& operator<<( log::begin const& ); // begin entry - unit_test_log_t& operator<<( log::end const& ); // end entry - unit_test_log_t& operator<<( log::file const& ); // set entry file name - unit_test_log_t& operator<<( log::line const& ); // set entry line number - unit_test_log_t& operator<<( log::checkpoint const& ); // set checkpoint - unit_test_log_t& operator<<( log_level ); // set entry level - ut_detail::entry_value_collector operator()( log_level ); - - // logging methods - unit_test_log_t& operator<<( const_string ); - void log_progress(); - void log_exception( log_level, const_string ); + ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection private: - // Constructor - unit_test_log_t(); + BOOST_TEST_SINGLETON_CONS( unit_test_log_t ); }; // unit_test_log_t -namespace { -unit_test_log_t& unit_test_log = unit_test_log_t::instance(); -} +BOOST_TEST_SINGLETON_INST( unit_test_log ) // helper macros -#define BOOST_UT_LOG_ENTRY \ - (boost::unit_test::unit_test_log << boost::unit_test::log::begin() \ - << boost::unit_test::log::file( BOOST_TEST_STRING_LITERAL( __FILE__ ) ) \ - << boost::unit_test::log::line( __LINE__ )) \ +#define BOOST_UT_LOG_ENTRY \ + (boost::unit_test::unit_test_log << boost::unit_test::log::begin() \ + << boost::unit_test::log::file( BOOST_TEST_L( __FILE__ ) ) \ + << boost::unit_test::log::line( __LINE__ )) \ /**/ } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.30 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.29 2005/02/02 12:08:14 rogeeff // namespace log added for log manipulators // @@ -177,5 +183,5 @@ unit_test_log_t& unit_test_log = unit_test_log_t::instance(); // // *************************************************************************** -#endif // BOOST_UNIT_TEST_LOG_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_LOG_HPP_071894GER diff --git a/include/boost/test/unit_test_log_formatter.hpp b/include/boost/test/unit_test_log_formatter.hpp index dfc554ee..34b21220 100755 --- a/include/boost/test/unit_test_log_formatter.hpp +++ b/include/boost/test/unit_test_log_formatter.hpp @@ -12,13 +12,13 @@ // Description : // *************************************************************************** -#ifndef BOOST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER -#define BOOST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER // Boost.Test -#include +#include #include -#include +#include // STL #include @@ -26,6 +26,8 @@ #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -81,31 +83,36 @@ public: virtual ~unit_test_log_formatter() {} // Formatter interface - virtual void start_log( std::ostream&, bool log_build_info ) = 0; - virtual void log_header( std::ostream&, counter_t test_cases_amount ) = 0; - virtual void finish_log( std::ostream& ) = 0; + virtual void log_start( std::ostream&, counter_t test_cases_amount ) = 0; + virtual void log_finish( std::ostream& ) = 0; + virtual void log_build_info( std::ostream& ) = 0; - virtual void start_test_case( test_case const& tc ) = 0; - virtual void test_case_enter( std::ostream&, test_case const& tc ) = 0; - virtual void test_case_exit( std::ostream&, test_case const& tc, long testing_time_in_mks ) = 0; + virtual void test_unit_start( std::ostream&, test_unit const& tu ) = 0; + virtual void test_unit_finish( std::ostream&, test_unit const& tu, unsigned long elapsed ) = 0; + virtual void test_unit_skipped( std::ostream&, test_unit const& ) = 0; virtual void log_exception( std::ostream&, log_checkpoint_data const&, const_string explanation ) = 0; - virtual void begin_log_entry( std::ostream&, log_entry_data const&, log_entry_types let ) = 0; + virtual void log_entry_start( std::ostream&, log_entry_data const&, log_entry_types let ) = 0; virtual void log_entry_value( std::ostream&, const_string value ) = 0; - virtual void end_log_entry( std::ostream& ) = 0; + virtual void log_entry_finish( std::ostream& ) = 0; }; } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.13 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.12 2005/02/01 08:59:28 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface @@ -133,5 +140,5 @@ public: // // *************************************************************************** -#endif // BOOST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER diff --git a/include/boost/test/detail/unit_test_monitor.hpp b/include/boost/test/unit_test_monitor.hpp similarity index 57% rename from include/boost/test/detail/unit_test_monitor.hpp rename to include/boost/test/unit_test_monitor.hpp index 3d080ffe..1097903b 100644 --- a/include/boost/test/detail/unit_test_monitor.hpp +++ b/include/boost/test/unit_test_monitor.hpp @@ -9,30 +9,32 @@ // // Version : $Revision$ // -// Description : defines specific version of execution monitor used to run unit -// test cases. Translates execution exception into error level +// Description : defines specific version of execution monitor used to managed +// run unit of test cases. Translates execution exception into error level // *************************************************************************** -#ifndef BOOST_UNIT_TEST_MONITOR_HPP_071894GER -#define BOOST_UNIT_TEST_MONITOR_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER +#define BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER // Boost.Test #include -#include +#include +#include +#include + #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { -namespace ut_detail { - // ************************************************************************** // // ************** unit_test_monitor ************** // // ************************************************************************** // -class unit_test_monitor : public execution_monitor { - typedef void (test_case::*function_to_monitor)(); +class unit_test_monitor_t : public singleton, public execution_monitor { public: enum error_level { test_fail = 1, @@ -45,42 +47,32 @@ public: destructor_error = -6 }; - static bool is_critical_error( error_level e_ ) { return e_ <= fatal_error; } - - // management method; same for all monitors - static void catch_system_errors( bool yes_no = true ) { s_catch_system_errors = yes_no; } + static bool is_critical_error( error_level e ) { return e <= fatal_error; } // monitor method - error_level execute_and_translate( test_case* target_test_case_, function_to_monitor f_, int timeout_ ); - - // execution monitor hook implementation - virtual int function(); + error_level execute_and_translate( test_case const& ); private: - // Data members - function_to_monitor m_test_case_method; - test_case* m_test_case; - static bool s_catch_system_errors; -}; // unit_test_monitor + BOOST_TEST_SINGLETON_CONS( unit_test_monitor_t ); +}; -} // namespace ut_detail +BOOST_TEST_SINGLETON_INST( unit_test_monitor ) } // namespace unit_test } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.18 2005/02/01 06:40:07 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed +// Revision 1.1 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** -#endif // BOOST_UNIT_TEST_MONITOR_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_MONITOR_HPP_020905GER diff --git a/include/boost/test/unit_test_result.hpp b/include/boost/test/unit_test_result.hpp deleted file mode 100644 index 03006bd3..00000000 --- a/include/boost/test/unit_test_result.hpp +++ /dev/null @@ -1,132 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines class unit_test_result that is responsible for -// gathering test results and presenting this information to end-user -// *************************************************************************** - -#ifndef BOOST_UNIT_TEST_RESULT_HPP_071894GER -#define BOOST_UNIT_TEST_RESULT_HPP_071894GER - -// Boost.Test -#include -#include - -// Boost -#include - -// STL -#include // std::ostream -#include // std::size_t -namespace boost { - -namespace unit_test { - -// ************************************************************************** // -// ************** first failed assertion hook ************** // -// ************************************************************************** // - -namespace { -inline void first_failed_assertion() {} -} - -// ************************************************************************** // -// ************** unit_test_result ************** // -// ************************************************************************** // - -class unit_test_result { - friend struct unit_test_result_saver; -public: - // Destructor - ~unit_test_result(); - - // current test results access and management - static unit_test_result& instance(); - static void test_case_enter( const_string name_, counter_t expected_failures_ = 0 ); - static void test_case_exit(); - - // report format configuration - static void set_report_format( const_string reportformat ); - - // use to dynamically change amount of errors expected in current test case - void increase_expected_failures( counter_t amount = 1 ); - - // reporting - void report( const_string reportlevel, std::ostream& where_to_ ); // report by level - void confirmation_report( std::ostream& where_to_ ); // shortest - void short_report( std::ostream& where_to_ ) { report( "short", where_to_ ); } // short - void detailed_report( std::ostream& where_to_ ) { report( "detailed", where_to_ ); } // long - - // test case result - int result_code() const; // to be returned from main - bool has_passed() const; // to manage test cases dependency - - // to be used by tool box implementation - void inc_failed_assertions(); - void inc_passed_assertions(); - - // to be used by monitor to notify that test case thrown exception - void caught_exception(); - - // used mostly by the Boost.Test unit testing - void failures_details( counter_t& num_of_failures_, bool& exception_caught_ ); - -private: - // report impl method - void report_result( std::ostream& where_to_, std::size_t indent_, bool detailed_ ); - - // used to temporarily introduce new results set without polluting current one - static void reset_current_result_set(); - - // Constructor - unit_test_result( unit_test_result* parent_, const_string test_case_name_, counter_t expected_failures_ = 0 ); - - // Data members - struct Impl; - boost::shared_ptr m_pimpl; -}; - -// ************************************************************************** // -// ************** unit_test_result_saver ************** // -// ************************************************************************** // - -struct unit_test_result_saver -{ - unit_test_result_saver() { unit_test_result::reset_current_result_set(); } - ~unit_test_result_saver() { unit_test_result::reset_current_result_set(); } -}; - -} // namespace unit_test - -} // namespace boost - -// *************************************************************************** -// Revision History : -// -// $Log$ -// Revision 1.25 2005/02/01 08:59:29 rogeeff -// supplied_log_formatters split -// change formatters interface to simplify result interface -// -// Revision 1.24 2005/02/01 06:40:06 rogeeff -// copyright update -// old log entries removed -// minor stilistic changes -// depricated tools removed -// -// Revision 1.23 2005/01/30 03:23:06 rogeeff -// result_tracker class removed -// counter type renamed -// -// *************************************************************************** - -#endif // BOOST_UNIT_TEST_RESULT_HPP_071894GER - diff --git a/include/boost/test/unit_test_suite.hpp b/include/boost/test/unit_test_suite.hpp index 24e96e5b..4b287bc4 100644 --- a/include/boost/test/unit_test_suite.hpp +++ b/include/boost/test/unit_test_suite.hpp @@ -1,5 +1,4 @@ -// (C) Copyright Gennadiy Rozental 2001-2005. -// (C) Copyright Ullrich Koethe 2001. +// (C) Copyright Gennadiy Rozental 2005. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -10,34 +9,34 @@ // // Version : $Revision$ // -// Description : defines all classes in test_case hierarchy and object generators -// for them. +// Description : defines test_unit, test_case, test_case_results, test_suite and test_tree_visitor // *************************************************************************** -#ifndef BOOST_UNIT_TEST_SUITE_HPP_071894GER -#define BOOST_UNIT_TEST_SUITE_HPP_071894GER +#ifndef BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER +#define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER // Boost.Test -#include -#include +#include +#include #include +#include +#include // Boost #include // STL -#include // for std::string +#include // for std::string +#include // for std::list + +#include //____________________________________________________________________________// #define BOOST_TEST_CASE( function ) \ -boost::unit_test::create_test_case((function), BOOST_TEST_STRINGIZE( function ) ) +boost::unit_test::make_test_case( boost::unit_test::callback0<>(function), BOOST_TEST_STRINGIZE( function ) ) #define BOOST_CLASS_TEST_CASE( function, tc_instance ) \ -boost::unit_test::create_test_case((function), BOOST_TEST_STRINGIZE( function ), tc_instance ) -#define BOOST_PARAM_TEST_CASE( function, begin, end ) \ -boost::unit_test::create_test_case((function), BOOST_TEST_STRINGIZE( function ), (begin), (end) ) -#define BOOST_PARAM_CLASS_TEST_CASE( function, tc_instance, begin, end ) \ -boost::unit_test::create_test_case((function), BOOST_TEST_STRINGIZE( function ), tc_instance, (begin), (end) ) +boost::unit_test::make_test_case((function), BOOST_TEST_STRINGIZE( function ), tc_instance ) #define BOOST_TEST_SUITE( testsuite_name ) \ ( new boost::unit_test::test_suite( testsuite_name ) ) @@ -45,276 +44,193 @@ namespace boost { namespace unit_test { +// ************************************************************************** // +// ************** test_unit ************** // +// ************************************************************************** // + +class test_unit { +public: + enum { type = tut_any }; + + // Constructor + test_unit( const_string tu_name, test_unit_type t ); + + // dependencies management + void depends_on( test_unit* tu ); + bool check_dependencies() const; + + // Public r/o properties + typedef BOOST_READONLY_PROPERTY(test_unit_id,(framework_impl)) id_t; + readonly_property p_name; // name for this test unit + readonly_property p_type; // type for this test unit + readonly_property p_type_name; // "case"/"suite" + id_t p_id; // unique id for this test unit + + // Public r/w properties + readwrite_property p_timeout; // timeout for the test unit execution + readwrite_property p_expected_failures; // number of expected failured in this test unit + +private: + // Data members + std::list m_dependencies; +}; + +// ************************************************************************** // +// ************** test_case_generator ************** // +// ************************************************************************** // + +class test_unit_generator { +public: + virtual test_unit* next() const = 0; + +protected: + BOOST_TEST_PROTECTED_VIRTUAL ~test_unit_generator() {} +}; + // ************************************************************************** // // ************** test_case ************** // // ************************************************************************** // -class test_case { +class test_case : public test_unit { public: - typedef ut_detail::unit_test_monitor::error_level error_level_type; - - // post creation configuration - void depends_on( test_case const* rhs ); - - // Destructor - virtual ~test_case() {} - - // total number of test cases - virtual counter_t size() const; - - // execute this method to run the test case - void run(); - - // status - bool has_passed() const; - - // public properties - BOOST_READONLY_PROPERTY( int, (test_case)(test_suite) ) - p_timeout; // timeout for the excecution monitor - BOOST_READONLY_PROPERTY( counter_t, (test_suite) ) - p_expected_failures; // number of assertions that are expected to fail in this test case - readonly_property - p_type; // true = test case, false - test suite - readonly_property - p_name; // name for this test case - - -protected: - // protected properties - BOOST_READONLY_PROPERTY( bool, (test_case)(test_suite) ) - p_compound_stage; // used to properly manage progress report - readwrite_property - p_stages_amount; // number of stages this test consist of; stage could be another test case - // like with test_suite, another parameterized test for parameterized_test_case - // or 1 stage that reflect single test_case behaviour - - // access methods - void curr_stage_is_compound(); + enum { type = tut_case }; // Constructor - explicit test_case( const_string name_, - bool type_, - counter_t stages_amount_, - bool monitor_run_ = true ); + test_case( const_string tc_name, callback0<> const& test_func ); - // test case implementation hooks to be called with unit_test_monitor or alone - virtual void do_init() {} - virtual void do_run() {} - virtual void do_destroy() {} + // Access methods + callback0<> const& test_func() const { return m_test_func; } private: + friend class framework_impl; + ~test_case() {} + + // BOOST_MSVC <= 1200 have problems with callback as property // Data members - struct Impl; - boost::shared_ptr m_pimpl; -}; - -//____________________________________________________________________________// - -extern ut_detail::unit_test_monitor the_monitor; - -template -void -register_exception_translator( ExceptionTranslator const& tr, boost::type* d = 0 ) -{ - the_monitor.register_exception_translator( tr, d ); -} - -//____________________________________________________________________________// - -// ************************************************************************** // -// ************** function_test_case ************** // -// ************************************************************************** // - -class function_test_case : public test_case { -public: - typedef void (*function_type)(); - - // Constructor - function_test_case( function_type f_, const_string name_ ) - : test_case( name_, true, 1 ), m_function( f_ ) {} - -protected: - // test case implementation - void do_run() { m_function(); } - -private: - // Data members - function_type m_function; -}; - -// ************************************************************************** // -// ************** class_test_case ************** // -// ************************************************************************** // - -template -class class_test_case : public test_case { -public: - typedef void (UserTestCase::*function_type)(); - - // Constructor - class_test_case( function_type f_, const_string name_, boost::shared_ptr const& user_test_case_ ) - : test_case( name_, true, 1 ), m_user_test_case( user_test_case_ ), m_function( f_ ) - {} - -private: - // test case implementation - void do_run() - { - if( (!!m_user_test_case) && m_function ) - ((*m_user_test_case).*m_function)(); - } - void do_destroy() - { - m_user_test_case.reset(); // t ofree the reference to the shared use test case instance - } - - // Data members - boost::shared_ptr m_user_test_case; - function_type m_function; -}; - -// ************************************************************************** // -// ************** parametrized_function_test_case ************** // -// ************************************************************************** // - -template -class parametrized_function_test_case : public test_case { -public: - typedef void (*function_type)( ParameterType ); - - // Constructor - parametrized_function_test_case( function_type f_, const_string name_, - ParamIterator const& par_begin_, ParamIterator const& par_end_ ) - : test_case( name_, true, 0 ), m_first_parameter( par_begin_ ), m_last_parameter( par_end_ ), m_function( f_ ) - { - // the typecasts are here to keep Borland C++ Builder 5 happy, for other compilers they have no effect: - p_stages_amount.set( ut_detail::distance( (ParamIterator)par_begin_, (ParamIterator)par_end_ ) ); - } - - // test case implementation - void do_init() { m_curr_parameter = m_first_parameter; } - void do_run() { m_function( *m_curr_parameter++ ); } - -private: - // Data members - ParamIterator m_first_parameter; - ParamIterator m_last_parameter; - ParamIterator m_curr_parameter; - - function_type m_function; -}; - -// ************************************************************************** // -// ************** parametrized_class_test_case ************** // -// ************************************************************************** // - -template -class parametrized_class_test_case : public test_case { -public: - typedef void (UserTestCase::*function_type)( ParameterType ); - - // Constructor - parametrized_class_test_case( function_type f_, const_string name_, boost::shared_ptrconst & user_test_case_, - ParamIterator const& par_begin_, ParamIterator const& par_end_ ) - : test_case( name_, true, 0 ) - , m_first_parameter( par_begin_ ) - , m_last_parameter( par_end_ ) - , m_user_test_case( user_test_case_ ) - , m_function( f_ ) - { - // the typecasts are here to keep Borland C++ Builder 5 happy, for other compilers they have no effect: - p_stages_amount.set( ut_detail::distance( (ParamIterator)par_begin_, (ParamIterator)par_end_ ) ); - } - - // test case implementation - void do_init() { m_curr_parameter = m_first_parameter; } - void do_run() { ((*m_user_test_case).*m_function)( *m_curr_parameter++ ); } - void do_destroy() { m_user_test_case.reset(); } - -private: - // Data members - ParamIterator m_first_parameter; - ParamIterator m_last_parameter; - ParamIterator m_curr_parameter; - - boost::shared_ptr m_user_test_case; - function_type m_function; + callback0<> m_test_func; }; // ************************************************************************** // // ************** test_suite ************** // // ************************************************************************** // -class test_suite : public test_case { +class test_suite : public test_unit { public: - // Constructor - explicit test_suite( const_string name_ = "Master" ); + enum { type = tut_suite }; - // Destructor - virtual ~test_suite(); + // Constructor + explicit test_suite( const_string ts_name = "Master" ); // test case list management - void add( test_case* tc_, counter_t expected_failures_ = 0, int timeout_ = 0 ); - - // access methods - counter_t size() const; - - // test case implementation - void do_init(); - void do_run(); + void add( test_unit* tu, counter_t expected_failures = 0, unsigned timeout = 0 ); + void add( test_unit_generator const& gen, unsigned timeout = 0 ); private: + friend void traverse_test_tree( test_suite const&, test_tree_visitor& ); + friend class framework_impl; + ~test_suite() {} + // Data members - struct Impl; - boost::shared_ptr m_pimpl; + std::list m_members; }; +// ************************************************************************** // +// ************** test_tree_visitor ************** // +// ************************************************************************** // + +class test_tree_visitor { +public: + // test tree visitor interface + virtual void visit( test_case const& ) {} + virtual bool test_suite_start( test_suite const& ) { return true; } + virtual void test_suite_finish( test_suite const& ) {} + +protected: + BOOST_TEST_PROTECTED_VIRTUAL ~test_tree_visitor() {} +}; + +// ************************************************************************** // +// ************** traverse_test_tree ************** // +// ************************************************************************** // + +void traverse_test_tree( test_case const&, test_tree_visitor& ); +void traverse_test_tree( test_suite const&, test_tree_visitor& ); +void traverse_test_tree( test_unit_id id, test_tree_visitor& ); + +//____________________________________________________________________________// + +inline void +traverse_test_tree( test_unit const& tu, test_tree_visitor& V ) +{ + if( tu.p_type == tut_case ) + traverse_test_tree( static_cast( tu ), V ); + else + traverse_test_tree( static_cast( tu ), V ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** test_case_counter ************** // +// ************************************************************************** // + +struct test_case_counter : test_tree_visitor { + test_case_counter() : m_count( 0 ) {} + + void visit( test_case const& ) { m_count++; } + + counter_t m_count; +}; + +// ************************************************************************** // +// ************** test_aborted ************** // +// ************************************************************************** // + +struct test_aborted {}; + // ************************************************************************** // // ************** object generators ************** // // ************************************************************************** // namespace ut_detail { -std::string normalize_test_case_name( const_string name_ ); +std::string normalize_test_case_name( const_string tu_name ); + +template +struct user_tc_method_invoker { + typedef void (UserTestCase::*test_method )(); + + user_tc_method_invoker( shared_ptr inst, test_method tm ) + : m_inst( inst ), m_test_method( tm ) {} + + void operator()() { ((*m_inst).*m_test_method)(); } + + shared_ptr m_inst; + test_method m_test_method; +}; + +//____________________________________________________________________________// } // namespace ut_detail //____________________________________________________________________________// inline test_case* -create_test_case( void (*fct_)(), const_string name_ ) +make_test_case( callback0<> const& test_func, const_string tc_name ) { - return new function_test_case( fct_, ut_detail::normalize_test_case_name( name_ ) ); + return new test_case( ut_detail::normalize_test_case_name( tc_name ), test_func ); } //____________________________________________________________________________// -template +template inline test_case* -create_test_case( void (UserTestCase::*fct_)(), const_string name_, boost::shared_ptr const& user_test_case_ ) +make_test_case( void (UserTestCase::*test_method )(), + const_string tc_name, + boost::shared_ptr const& user_test_case ) { - return new class_test_case( fct_, ut_detail::normalize_test_case_name( name_ ), user_test_case_ ); -} - -//____________________________________________________________________________// - -template -inline test_case* -create_test_case( void (*fct_)( ParamType ), const_string name_, ParamIterator const& par_begin_, ParamIterator const& par_end_ ) -{ - return new parametrized_function_test_case( - fct_, ut_detail::normalize_test_case_name( name_ ), par_begin_, par_end_ ); -} - -//____________________________________________________________________________// - -template -inline test_case* -create_test_case( void (UserTestCase::*fct_)( ParamType ), const_string name_, boost::shared_ptr const& user_test_case_, - ParamIterator const& par_begin_, ParamIterator const& par_end_ ) -{ - return new parametrized_class_test_case( - fct_, ut_detail::normalize_test_case_name( name_ ), user_test_case_, par_begin_, par_end_ ); + return new test_case( ut_detail::normalize_test_case_name( tc_name ), + ut_detail::user_tc_method_invoker( user_test_case, test_method ) ); } //____________________________________________________________________________// @@ -323,15 +239,22 @@ create_test_case( void (UserTestCase::*fct_)( ParamType ), const_string name_, b } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.28 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.27 2005/02/01 06:40:06 rogeeff // copyright update // old log entries removed -// minor stilistic changes -// depricated tools removed +// minor stylistic changes +// deprecated tools removed // // Revision 1.26 2005/01/30 03:22:07 rogeeff // interface changed to use const_string @@ -342,5 +265,5 @@ create_test_case( void (UserTestCase::*fct_)( ParamType ), const_string name_, b // // *************************************************************************** -#endif // BOOST_UNIT_TEST_SUITE_HPP_071894GER +#endif // BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER diff --git a/include/boost/test/unit_test_suite_ex.hpp b/include/boost/test/unit_test_suite_ex.hpp index 00a2915e..cb2d5665 100644 --- a/include/boost/test/unit_test_suite_ex.hpp +++ b/include/boost/test/unit_test_suite_ex.hpp @@ -13,17 +13,21 @@ // boost::function as a test case base function. // *************************************************************************** -#ifndef BOOST_UNIT_TEST_SUITE_EX_HPP_071894GER -#define BOOST_UNIT_TEST_SUITE_EX_HPP_071894GER +#ifndef BOOST_TEST_SUITE_EX_HPP_071894GER +#define BOOST_TEST_SUITE_EX_HPP_071894GER // Boost.Test #include -#include +#include // Boost #include #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -84,14 +88,14 @@ private: // ************************************************************************** // inline test_case* -create_test_case( function0 const& fct_, const_string name_ ) +make_test_case( function0 const& fct_, const_string name_ ) { return new boost_function_test_case( fct_, ut_detail::normalize_test_case_name( name_ ) ); } template inline test_case* -create_test_case( function1 const& fct_, const_string name_, +make_test_case( function1 const& fct_, const_string name_, ParamIterator const& begin_, ParamIterator const& end_ ) { return new parametrized_boost_function_test_case( @@ -102,10 +106,17 @@ create_test_case( function1 const& fct_, const_string name_, } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.22 2005/02/20 08:27:06 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.21 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed @@ -117,4 +128,4 @@ create_test_case( function1 const& fct_, const_string name_, // // *************************************************************************** -#endif // BOOST_UNIT_TEST_SUITE_EX_HPP_071894GER +#endif // BOOST_TEST_SUITE_EX_HPP_071894GER diff --git a/include/boost/test/utils/algorithm.hpp b/include/boost/test/utils/algorithm.hpp index b490ab57..f92cc72a 100644 --- a/include/boost/test/utils/algorithm.hpp +++ b/include/boost/test/utils/algorithm.hpp @@ -17,6 +17,10 @@ #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -213,10 +217,17 @@ find_last_not_of( BidirectionalIterator1 first1, BidirectionalIterator1 last1, } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 08:59:39 rogeeff // supplied_log_formatters split // change formatters interface to simplify result interface diff --git a/include/boost/test/utils/basic_cstring/basic_cstring.hpp b/include/boost/test/utils/basic_cstring/basic_cstring.hpp index dfb9ed56..436de055 100644 --- a/include/boost/test/utils/basic_cstring/basic_cstring.hpp +++ b/include/boost/test/utils/basic_cstring/basic_cstring.hpp @@ -13,8 +13,8 @@ // interface // *************************************************************************** -#ifndef BASIC_CSTRING_HPP_071894GER -#define BASIC_CSTRING_HPP_071894GER +#ifndef BOOST_TEST_BASIC_CSTRING_HPP_071894GER +#define BOOST_TEST_BASIC_CSTRING_HPP_071894GER // Boost.Test #include @@ -23,6 +23,10 @@ // STL #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -714,10 +718,17 @@ last_char( basic_cstring source ) } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed @@ -735,4 +746,4 @@ last_char( basic_cstring source ) // // *************************************************************************** -#endif // BASIC_CSTRING_HPP_071894GER +#endif // BOOST_TEST_BASIC_CSTRING_HPP_071894GER diff --git a/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp index 758174f7..b9ee8cf5 100644 --- a/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp +++ b/include/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp @@ -13,8 +13,8 @@ // interface // *************************************************************************** -#ifndef BASIC_CSTRING_FWD_HPP_071894GER -#define BASIC_CSTRING_FWD_HPP_071894GER +#ifndef BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER +#define BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER #include @@ -40,6 +40,9 @@ typedef char const* const c_literal_string; // Revision History : // // $Log$ +// Revision 1.3 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.2 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed @@ -51,5 +54,5 @@ typedef char const* const c_literal_string; // // *************************************************************************** -#endif // BASIC_CSTRING_FWD_HPP_071894GER +#endif // BOOST_TEST_BASIC_CSTRING_FWD_HPP_071894GER diff --git a/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp b/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp index ca4d6c95..ab8486ed 100644 --- a/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp +++ b/include/boost/test/utils/basic_cstring/bcs_char_traits.hpp @@ -12,18 +12,23 @@ // Description : generic char traits class; wraps std::char_traits // *************************************************************************** -#ifndef BCS_CHAR_TRAITS_HPP_071894GER -#define BCS_CHAR_TRAITS_HPP_071894GER +#ifndef BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER +#define BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER // Boost #include #include +#include #include // STL #include // std::char_traits #include // std::size_t +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -138,10 +143,17 @@ public: } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.3 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.2 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed @@ -153,4 +165,4 @@ public: // // *************************************************************************** -#endif // BCS_CHAR_TRAITS_HPP_071894GER +#endif // BOOST_TEST_BCS_CHAR_TRAITS_HPP_071894GER diff --git a/include/boost/test/utils/basic_cstring/compare.hpp b/include/boost/test/utils/basic_cstring/compare.hpp index 35712617..9167cf28 100644 --- a/include/boost/test/utils/basic_cstring/compare.hpp +++ b/include/boost/test/utils/basic_cstring/compare.hpp @@ -12,8 +12,8 @@ // Description : class basic_cstring comparisons implementation // *************************************************************************** -#ifndef BASIC_CSTRING_COMPARE_HPP_071894GER -#define BASIC_CSTRING_COMPARE_HPP_071894GER +#ifndef BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER +#define BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER // Boost.Test #include @@ -22,6 +22,10 @@ #include #include +#include + +//____________________________________________________________________________// + # if defined(BOOST_NO_STDC_NAMESPACE) && !BOOST_WORKAROUND(__BORLANDC__, <= 0x570) && !BOOST_WORKAROUND(__GNUC__, < 3) namespace std { using ::toupper; } # endif @@ -104,10 +108,17 @@ operator <( boost::unit_test::basic_cstring const& x, } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed @@ -125,4 +136,4 @@ operator <( boost::unit_test::basic_cstring const& x, // // *************************************************************************** -#endif // BASIC_CSTRING_COMPARE_HPP_071894GER +#endif // BOOST_TEST_BASIC_CSTRING_COMPARE_HPP_071894GER diff --git a/include/boost/test/utils/basic_cstring/io.hpp b/include/boost/test/utils/basic_cstring/io.hpp index 01ced888..0aedccc3 100644 --- a/include/boost/test/utils/basic_cstring/io.hpp +++ b/include/boost/test/utils/basic_cstring/io.hpp @@ -12,8 +12,8 @@ // Description : basic_cstring i/o implementation // *************************************************************************** -#ifndef BASIC_CSTRING_IO_HPP_071894GER -#define BASIC_CSTRING_IO_HPP_071894GER +#ifndef BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER +#define BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER // Boost.Test #include @@ -22,6 +22,8 @@ #include #include +#include + //____________________________________________________________________________// namespace boost { @@ -64,10 +66,17 @@ operator<<( std::basic_ostream& os, basic_cstring const& str } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed @@ -82,4 +91,4 @@ operator<<( std::basic_ostream& os, basic_cstring const& str // // *************************************************************************** -#endif // BASIC_CSTRING_IO_HPP_071894GER +#endif // BOOST_TEST_BASIC_CSTRING_IO_HPP_071894GER diff --git a/include/boost/test/utils/callback.hpp b/include/boost/test/utils/callback.hpp new file mode 100644 index 00000000..24a32925 --- /dev/null +++ b/include/boost/test/utils/callback.hpp @@ -0,0 +1,285 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Use, modification, and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : +// *************************************************************************** + +#ifndef BOOST_TEST_CALLBACK_020505GER +#define BOOST_TEST_CALLBACK_020505GER + +// Boost +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace ut_detail { + +struct unused {}; + +template +struct invoker { + template + R invoke( Functor& f ) { return f(); } + template + R invoke( Functor& f, T1 t1 ) { return f( t1 ); } + template + R invoke( Functor& f, T1 t1, T2 t2 ) { return f( t1, t2 ); } + template + R invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { return f( t1, t2, t3 ); } +}; + +template<> +struct invoker { + template + unused invoke( Functor& f ) { f(); return unused(); } + template + unused invoke( Functor& f, T1 t1 ) { f( t1 ); return unused(); } + template + unused invoke( Functor& f, T1 t1, T2 t2 ) { f( t1, t2 ); return unused(); } + template + unused invoke( Functor& f, T1 t1, T2 t2, T3 t3 ) { f( t1, t2, t3 ); return unused(); } +}; + +} // namespace ut_detail + +// ************************************************************************** // +// ************** unit_test::callback0 ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct callback0_impl { + virtual ~callback0_impl() {} + + virtual R invoke() = 0; +}; + +template +struct callback0_impl_t : callback0_impl { + // Constructor + explicit callback0_impl_t( Functor f ) : m_f( f ) {} + + virtual R invoke() { return invoker().invoke( m_f ); } + +private: + // Data members + Functor m_f; +}; + +} // namespace ut_detail + +template +class callback0 { +public: + // Constructors + callback0() {} + callback0( callback0 const& rhs ) : m_impl( rhs.m_impl ) {} + + template + callback0( Functor f ) + : m_impl( new ut_detail::callback0_impl_t( f ) ) {} + + void operator=( callback0 const& rhs ) { m_impl = rhs.m_impl; } + + template + void operator=( Functor f ) { m_impl.reset( new ut_detail::callback0_impl_t( f ) ); } + + R operator()() const { return m_impl->invoke(); } + + bool operator!() const { return !m_impl; } + +private: + // Data members + boost::shared_ptr > m_impl; +}; + +// ************************************************************************** // +// ************** unit_test::callback1 ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct callback1_impl { + virtual ~callback1_impl() {} + + virtual R invoke( T1 t1 ) = 0; +}; + +template +struct callback1_impl_t : callback1_impl { + // Constructor + explicit callback1_impl_t( Functor f ) : m_f( f ) {} + + virtual R invoke( T1 t1 ) { return invoker().invoke( m_f, t1 ); } + +private: + // Data members + Functor m_f; +}; + +} // namespace ut_detail + +template +class callback1 { +public: + // Constructors + callback1() {} + callback1( callback1 const& rhs ) : m_impl( rhs.m_impl ) {} + + template + callback1( Functor f ) + : m_impl( new ut_detail::callback1_impl_t( f ) ) {} + + void operator=( callback1 const& rhs ) { m_impl = rhs.m_impl; } + + template + void operator=( Functor f ) { m_impl.reset( new ut_detail::callback1_impl_t( f ) ); } + + R operator()( T1 t1 ) const { return m_impl->invoke( t1 ); } + + bool operator!() const { return !m_impl; } + +private: + // Data members + boost::shared_ptr > m_impl; +}; + +// ************************************************************************** // +// ************** unit_test::callback2 ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct callback2_impl { + virtual ~callback2_impl() {} + + virtual R invoke( T1 t1, T2 t2 ) = 0; +}; + +template +struct callback2_impl_t : callback2_impl { + // Constructor + explicit callback2_impl_t( Functor f ) : m_f( f ) {} + + virtual R invoke( T1 t1, T2 t2 ) { return invoker().invoke( m_f, t1, t2 ); } + +private: + // Data members + Functor m_f; +}; + +} // namespace ut_detail + +template +class callback2 { +public: + // Constructors + callback2() {} + callback2( callback2 const& rhs ) : m_impl( rhs.m_impl ) {} + + template + callback2( Functor f ) : m_impl( new ut_detail::callback2_impl_t( f ) ) {} + + void operator=( callback2 const& rhs ) { m_impl = rhs.m_impl; } + + template + void operator=( Functor f ) { m_impl.reset( new ut_detail::callback2_impl_t( f ) ); } + + R operator()( T1 t1, T2 t2 ) const { return m_impl->invoke( t1, t2 ); } + + bool operator!() const { return !m_impl; } + +private: + // Data members + boost::shared_ptr > m_impl; +}; + +// ************************************************************************** // +// ************** unit_test::callback3 ************** // +// ************************************************************************** // + +namespace ut_detail { + +template +struct callback3_impl { + virtual ~callback3_impl() {} + + virtual R invoke( T1 t1, T2 t2, T3 t3 ) = 0; +}; + +template +struct callback3_impl_t : callback3_impl { + // Constructor + explicit callback3_impl_t( Functor f ) : m_f( f ) {} + + virtual R invoke( T1 t1, T2 t2, T3 t3 ) { return invoker().invoke( m_f, t1, t2, t3 ); } + +private: + // Data members + Functor m_f; +}; + +} // namespace ut_detail + +template +class callback3 { +public: + // Constructors + callback3() {} + callback3( callback3 const& rhs ) : m_impl( rhs.m_impl ) {} + + template + callback3( Functor f ) + : m_impl( new ut_detail::callback3_impl_t( f ) ) {} + + void operator=( callback3 const& rhs ) { m_impl = rhs.m_impl; } + + template + void operator=( Functor f ) { m_impl.reset( new ut_detail::callback3_impl_t( f ) ); } + + R operator()( T1 t1, T2 t2, T3 t3 ) const { return m_impl->invoke( t1, t2, t3 ); } + + bool operator!() const { return !m_impl; } + +private: + // Data members + boost::shared_ptr > m_impl; +}; + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// ************************************************************************** // +// Revision History: +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// ************************************************************************** // + +#endif // BOOST_TEST_CALLBACK_020505GER diff --git a/include/boost/test/utils/class_properties.hpp b/include/boost/test/utils/class_properties.hpp index ae68ced1..c56f5f57 100644 --- a/include/boost/test/utils/class_properties.hpp +++ b/include/boost/test/utils/class_properties.hpp @@ -17,7 +17,7 @@ #define BOOST_TEST_CLASS_PROPERTIES_HPP_071894GER // Boost.Test -#include +#include // Boost #if !BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) @@ -31,6 +31,10 @@ // STL #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -49,7 +53,8 @@ protected: public: // Constructor class_property() : value( PropertyType() ) {} - explicit class_property( write_param_t init_value ) : value( init_value ) {} + explicit class_property( write_param_t init_value ) + : value( init_value ) {} // Access methods operator read_access_t() const { return value; } @@ -208,12 +213,19 @@ public: } // namespace boost +//____________________________________________________________________________// + +#include + #undef BOOST_TEST_NO_PROTECTED_USING // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/custom_manip.hpp b/include/boost/test/utils/custom_manip.hpp index 1015112f..16e1b45e 100644 --- a/include/boost/test/utils/custom_manip.hpp +++ b/include/boost/test/utils/custom_manip.hpp @@ -20,6 +20,8 @@ #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -54,12 +56,17 @@ operator<<( std::ostream& ostr, custom_manip const& ) { return custom_prin } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.2 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.1 2005/01/22 18:21:39 rogeeff // moved sharable staff into utils // diff --git a/include/boost/test/utils/fixed_mapping.hpp b/include/boost/test/utils/fixed_mapping.hpp index 623677e5..0e4d441f 100644 --- a/include/boost/test/utils/fixed_mapping.hpp +++ b/include/boost/test/utils/fixed_mapping.hpp @@ -27,6 +27,10 @@ #include #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -104,6 +108,10 @@ private: } // namespace boost +//____________________________________________________________________________// + +#include + #undef MAX_MAP_SIZE #undef CONSTR_DECL_MID #undef CONSTR_BODY_MID @@ -114,6 +122,9 @@ private: // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/foreach.hpp b/include/boost/test/utils/foreach.hpp new file mode 100644 index 00000000..a7787e6f --- /dev/null +++ b/include/boost/test/utils/foreach.hpp @@ -0,0 +1,306 @@ +// (C) Copyright Eric Niebler 2004-2005 +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : this is an abridged version of an excelent BOOST_FOREACH facility +// presented by Eric Niebler. I am so fond of it so I couldn't wait till it +// going to be accepted into Boost. Also I need version with less number of dependencies +// and more portable. This version doesn't support rvalues and will reeveluate it's +// parameters, but should be good enough for my purposes. +// *************************************************************************** + +#ifndef BOOST_TEST_FOREACH_HPP_021005GER +#define BOOST_TEST_FOREACH_HPP_021005GER + +// Boost.Test +#include + +// Boost +#include +#include +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +namespace for_each { + +// ************************************************************************** // +// ************** static_any ************** // +// ************************************************************************** // + +struct static_any_base +{ + operator bool() const { return false; } +}; + +//____________________________________________________________________________// + +template +struct static_any : static_any_base +{ + static_any( Iter const& t ) : m_it( t ) {} + + mutable Iter m_it; +}; + +//____________________________________________________________________________// + +typedef static_any_base const& static_any_t; + +//____________________________________________________________________________// + +template +inline Iter& +static_any_cast( static_any_t a, Iter* = 0 ) +{ + return static_cast( static_cast const&>( a ).m_it ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** is_const ************** // +// ************************************************************************** // + +template +inline boost::is_const +is_const_coll( C& ) +{ + return boost::is_const(); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** begin ************** // +// ************************************************************************** // + +template +inline static_any +begin( C& t, mpl::false_ ) +{ + return static_any( t.begin() ); +} + +//____________________________________________________________________________// + +template +inline static_any +begin( C& t, mpl::true_ ) +{ + return static_any( t.begin() ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** end ************** // +// ************************************************************************** // + +template +inline static_any +end( C& t, mpl::false_ ) +{ + return static_any( t.end() ); +} + +//____________________________________________________________________________// + +template +inline static_any +end( C& t, mpl::true_ ) +{ + return static_any( t.end() ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** done ************** // +// ************************************************************************** // + +template +inline bool +done( static_any_t cur, static_any_t end, C&, mpl::false_ ) +{ + return static_any_cast( cur ) == + static_any_cast( end ); +} + +//____________________________________________________________________________// + +template +inline bool +done( static_any_t cur, static_any_t end, C const&, mpl::true_ ) +{ + return static_any_cast( cur ) == + static_any_cast( end ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** next ************** // +// ************************************************************************** // + +template +inline void +next( static_any_t cur, C&, mpl::false_ ) +{ + ++static_any_cast( cur ); +} + +//____________________________________________________________________________// + +template +inline void +next( static_any_t cur, C const&, mpl::true_ ) +{ + ++static_any_cast( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** deref ************** // +// ************************************************************************** // + +template +inline RefType +deref( static_any_t cur, C&, ::boost::type, mpl::false_ ) +{ + return *static_any_cast( cur ); +} + +//____________________________________________________________________________// + +template +inline RefType +deref( static_any_t cur, C const&, ::boost::type, mpl::true_ ) +{ + return *static_any_cast( cur ); +} + +//____________________________________________________________________________// + +// ************************************************************************** // +// ************** BOOST_TEST_FOREACH ************** // +// ************************************************************************** // + +#if BOOST_WORKAROUND(__GNUC__, < 3) +#define BOOST_TEST_FE_MULTISTATEMENT +#endif + +#define BOOST_TEST_FE_ANY ::boost::unit_test::for_each::static_any_t +#define BOOST_TEST_FE_IS_CONST( COL ) ::boost::unit_test::for_each::is_const_coll( COL ) + +#define BOOST_TEST_FE_BEG( COL ) \ + ::boost::unit_test::for_each::begin( \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_END( COL ) \ + ::boost::unit_test::for_each::end( \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_DONE( COL ) \ + ::boost::unit_test::for_each::done( \ + BOOST_TEST_FE_CUR_VAR, \ + BOOST_TEST_FE_END_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_NEXT( COL ) \ + ::boost::unit_test::for_each::next( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_FOREACH_NOOP(COL) \ + ((void)&(COL)) + +#define BOOST_TEST_FE_DEREF( COL, RefType ) \ + ::boost::unit_test::for_each::deref( \ + BOOST_TEST_FE_CUR_VAR, \ + COL, \ + ::boost::type(), \ + BOOST_TEST_FE_IS_CONST( COL ) ) \ +/**/ + +#define BOOST_TEST_FE_CUR_VAR BOOST_JOIN( _fe_cur_, __LINE__ ) +#define BOOST_TEST_FE_END_VAR BOOST_JOIN( _fe_end_, __LINE__ ) +#define BOOST_TEST_FE_CON_VAR BOOST_JOIN( _fe_con_, __LINE__ ) + +#ifndef BOOST_TEST_FE_MULTISTATEMENT + +#define BOOST_TEST_FOREACH( RefType, var, COL ) \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_BEG( COL ) ) {} else \ +if( BOOST_TEST_FE_ANY BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_END( COL ) ) {} else \ +for( bool BOOST_TEST_FE_CON_VAR = true; \ + BOOST_TEST_FE_CON_VAR && !BOOST_TEST_FE_DONE( COL ); \ + BOOST_TEST_FE_CON_VAR ? BOOST_TEST_FE_NEXT( COL ) : BOOST_FOREACH_NOOP( COL )) \ + \ + if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ + for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ + !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ +/**/ + +#else + +#define BOOST_TEST_FOREACH( RefType, var, COL ) \ +BOOST_TEST_FE_ANY BOOST_TEST_FE_CUR_VAR = BOOST_TEST_FE_BEG( COL ), \ + BOOST_TEST_FE_END_VAR = BOOST_TEST_FE_END( COL ); \ + \ +for( bool BOOST_TEST_FE_CON_VAR = true; BOOST_TEST_FE_CON_VAR; ) \ +for( ; \ + BOOST_TEST_FE_CON_VAR && (BOOST_TEST_FE_CON_VAR = !BOOST_TEST_FE_DONE( COL )); \ + BOOST_TEST_FE_CON_VAR ? BOOST_TEST_FE_NEXT( COL ) : BOOST_FOREACH_NOOP( COL )) \ + \ + if( (BOOST_TEST_FE_CON_VAR = false, false) ) {} else \ + for( RefType var = BOOST_TEST_FE_DEREF( COL, RefType ); \ + !BOOST_TEST_FE_CON_VAR; BOOST_TEST_FE_CON_VAR = true ) \ +/**/ + +#endif + +//____________________________________________________________________________// + +} // namespace for_each + +} // namespace unit_test + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_FOREACH_HPP_021005GER diff --git a/include/boost/test/utils/iterator/ifstream_line_iterator.hpp b/include/boost/test/utils/iterator/ifstream_line_iterator.hpp index e9049f81..28d786a6 100644 --- a/include/boost/test/utils/iterator/ifstream_line_iterator.hpp +++ b/include/boost/test/utils/iterator/ifstream_line_iterator.hpp @@ -21,6 +21,10 @@ // STL #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -92,10 +96,17 @@ typedef basic_ifstream_line_iterator wifstream_line_iterator; } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/iterator/input_iterator_facade.hpp b/include/boost/test/utils/iterator/input_iterator_facade.hpp index 756c67a6..3a93723a 100644 --- a/include/boost/test/utils/iterator/input_iterator_facade.hpp +++ b/include/boost/test/utils/iterator/input_iterator_facade.hpp @@ -18,6 +18,10 @@ // Boost #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -97,10 +101,17 @@ private: } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.3 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.2 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/iterator/istream_line_iterator.hpp b/include/boost/test/utils/iterator/istream_line_iterator.hpp index d9c21773..02daf7a4 100644 --- a/include/boost/test/utils/iterator/istream_line_iterator.hpp +++ b/include/boost/test/utils/iterator/istream_line_iterator.hpp @@ -22,6 +22,10 @@ // STL #include +#include + +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -85,10 +89,17 @@ typedef basic_istream_line_iterator wistream_line_iterator; } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/iterator/token_iterator.hpp b/include/boost/test/utils/iterator/token_iterator.hpp index 98eccfbd..426cccc5 100644 --- a/include/boost/test/utils/iterator/token_iterator.hpp +++ b/include/boost/test/utils/iterator/token_iterator.hpp @@ -26,6 +26,10 @@ #include #include +#include + +//____________________________________________________________________________// + #ifdef BOOST_NO_STDC_NAMESPACE namespace std{ using ::ispunct; using ::isspace; } #endif @@ -561,10 +565,17 @@ make_range_token_iterator( Iter begin, Iter end, M1 const& m1, M2 const& m2, M3 } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:09 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/nullstream.hpp b/include/boost/test/utils/nullstream.hpp index 7e8ffea7..15287191 100644 --- a/include/boost/test/utils/nullstream.hpp +++ b/include/boost/test/utils/nullstream.hpp @@ -22,6 +22,10 @@ #include +#include + +//____________________________________________________________________________// + namespace boost { // ************************************************************************** // @@ -89,10 +93,17 @@ typedef basic_onullstream wonullstream; } // namespace boost +//____________________________________________________________________________// + +#include + // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.4 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/trivial_singleton.hpp b/include/boost/test/utils/trivial_singleton.hpp new file mode 100644 index 00000000..e0b13c35 --- /dev/null +++ b/include/boost/test/utils/trivial_singleton.hpp @@ -0,0 +1,66 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : simple helpers for creating cusom output manipulators +// *************************************************************************** + +#ifndef BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER +#define BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER + +#include + +#include + +//____________________________________________________________________________// + +namespace boost { + +namespace unit_test { + +// ************************************************************************** // +// ************** singleton ************** // +// ************************************************************************** // + +template +class singleton : private boost::noncopyable { +public: + static Derived& instance() { static Derived the_inst; return the_inst; } +protected: + singleton() {} + ~singleton() {} +}; + +} // namespace unit_test + +#define BOOST_TEST_SINGLETON_CONS( type ) \ +friend class boost::unit_test::singleton; \ +type() {} \ +/**/ + +#define BOOST_TEST_SINGLETON_INST( inst ) \ +namespace { BOOST_JOIN( inst, _t)& inst = BOOST_JOIN( inst, _t)::instance(); } + +} // namespace boost + +//____________________________________________________________________________// + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +#endif // BOOST_TEST_TRIVIAL_SIGNLETON_HPP_020505GER diff --git a/include/boost/test/utils/wrap_stringstream.hpp b/include/boost/test/utils/wrap_stringstream.hpp index 156c31ba..b4a9e36a 100644 --- a/include/boost/test/utils/wrap_stringstream.hpp +++ b/include/boost/test/utils/wrap_stringstream.hpp @@ -16,6 +16,9 @@ #ifndef BOOST_WRAP_STRINGSTREAM_HPP_071894GER #define BOOST_WRAP_STRINGSTREAM_HPP_071894GER +// Boost.Test +#include + // STL #ifdef BOOST_NO_STRINGSTREAM #include // for std::ostrstream @@ -25,6 +28,8 @@ #include +//____________________________________________________________________________// + namespace boost { // ************************************************************************** // @@ -152,12 +157,17 @@ typedef basic_wrap_stringstream wrap_wstringstream; } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.6 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.5 2005/02/01 06:40:07 rogeeff // copyright update // old log entries removed diff --git a/include/boost/test/utils/xml_printer.hpp b/include/boost/test/utils/xml_printer.hpp index 395e8efb..ddaf9464 100644 --- a/include/boost/test/utils/xml_printer.hpp +++ b/include/boost/test/utils/xml_printer.hpp @@ -19,6 +19,7 @@ #include #include #include +#include // Boost #include @@ -28,6 +29,8 @@ #include +//____________________________________________________________________________// + namespace boost { namespace unit_test { @@ -49,13 +52,13 @@ print_escaped( std::ostream& where_to, const_string value ) 0 ); - for( const_string::iterator it = value.begin(); it != value.end(); ++it ) { - char const* ref = char_type[*it]; + BOOST_TEST_FOREACH( char, c, value ) { + char const* ref = char_type[c]; if( ref ) where_to << '&' << ref << ';'; else - where_to << *it; + where_to << c; } } @@ -100,12 +103,17 @@ operator<<( custom_printer const& p, const_string value ) } // namespace boost +//____________________________________________________________________________// + #include // *************************************************************************** // Revision History : // // $Log$ +// Revision 1.5 2005/02/20 08:27:08 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.4 2005/02/01 06:40:08 rogeeff // copyright update // old log entries removed diff --git a/src/framework.cpp b/src/framework.cpp new file mode 100644 index 00000000..c18b1973 --- /dev/null +++ b/src/framework.cpp @@ -0,0 +1,26 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : forwarding source +// *************************************************************************** + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +// EOF diff --git a/src/plain_report_formatter.cpp b/src/plain_report_formatter.cpp new file mode 100644 index 00000000..bbf6c700 --- /dev/null +++ b/src/plain_report_formatter.cpp @@ -0,0 +1,26 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : forwarding source +// *************************************************************************** + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +// EOF diff --git a/src/unit_test_result.cpp b/src/progress_monitor.cpp similarity index 75% rename from src/unit_test_result.cpp rename to src/progress_monitor.cpp index d589259d..d5600ffa 100644 --- a/src/unit_test_result.cpp +++ b/src/progress_monitor.cpp @@ -12,13 +12,16 @@ // Description : forwarding source // *************************************************************************** -#include +#include // *************************************************************************** // Revision History : // // $Log$ -// Revision 1.33 2005/01/22 19:26:37 rogeeff +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// Revision 1.16 2005/01/22 19:26:35 rogeeff // implementation moved into headers section to eliminate dependency of included/minimal component on src directory // // *************************************************************************** diff --git a/src/results_collector.cpp b/src/results_collector.cpp new file mode 100644 index 00000000..9396b25b --- /dev/null +++ b/src/results_collector.cpp @@ -0,0 +1,26 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : forwarding source +// *************************************************************************** + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +// EOF diff --git a/src/results_reporter.cpp b/src/results_reporter.cpp new file mode 100644 index 00000000..b013cb15 --- /dev/null +++ b/src/results_reporter.cpp @@ -0,0 +1,26 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : forwarding source +// *************************************************************************** + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +// EOF diff --git a/src/xml_report_formatter.cpp b/src/xml_report_formatter.cpp new file mode 100644 index 00000000..2ddb4314 --- /dev/null +++ b/src/xml_report_formatter.cpp @@ -0,0 +1,26 @@ +// (C) Copyright Gennadiy Rozental 2005. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/test for the library home page. +// +// File : $RCSfile$ +// +// Version : $Revision$ +// +// Description : forwarding source +// *************************************************************************** + +#include + +// *************************************************************************** +// Revision History : +// +// $Log$ +// Revision 1.1 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// +// *************************************************************************** + +// EOF diff --git a/test/Jamfile b/test/Jamfile index ecb53c02..ff3c98e4 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -51,10 +51,9 @@ test-suite "test_exec_monitor_test" test-suite "unit_test_framework_test" : -# errors_handling_test has been commented out because it is in effect a Windows -# only test and no one has volunteered to get it working on other O/S's. [ test-btl-lib run : errors_handling_test : boost_test_exec_monitor : $(test-dir)/test_files/errors_handling_test.pattern ] [ test-btl-lib run : online_test ] + [ test-btl-lib run : foreach_test ] [ test-btl-lib run-fail : minimal_test ] [ test-btl-lib run : output_test_stream_test : boost_unit_test_framework ] [ test-btl-lib run : result_report_test : boost_test_exec_monitor : $(test-dir)test_files/result_report_test.pattern ] @@ -63,7 +62,6 @@ test-suite "unit_test_framework_test" [ test-btl-lib run : test_tools_test : boost_unit_test_framework ] [ test-btl-lib run : auto_unit_test_test : boost_unit_test_framework ] [ test-btl-lib run : auto_unit_test_test_mult : boost_unit_test_framework : : auto_unit_test_test_mult1.cpp auto_unit_test_test_mult2.cpp ] - [ test-btl-lib run : unit_test_suite_ex_test : boost_unit_test_framework ] [ test-btl-lib run : test_case_template_test : boost_test_exec_monitor ] [ test-btl-lib run : custom_exception_test : boost_unit_test_framework ] [ test-btl-lib run : fixed_mapping_test : boost_unit_test_framework ] diff --git a/test/algorithms_test.cpp b/test/algorithms_test.cpp index 4512c652..8500ca1d 100755 --- a/test/algorithms_test.cpp +++ b/test/algorithms_test.cpp @@ -113,7 +113,7 @@ void test_find_last_not_of() //____________________________________________________________________________// utf::test_suite* -init_unit_test_suite( int argc, char* argv[] ) +init_unit_test_suite( int /* argc */, char* /* argv */ [] ) { utf::test_suite* test= BOOST_TEST_SUITE("Algorithms test"); @@ -131,6 +131,9 @@ init_unit_test_suite( int argc, char* argv[] ) // History : // // $Log$ +// Revision 1.4 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.3 2005/01/30 03:35:55 rogeeff // no message // diff --git a/test/auto_unit_test_test.cpp b/test/auto_unit_test_test.cpp index 522b75bf..26eb3c90 100644 --- a/test/auto_unit_test_test.cpp +++ b/test/auto_unit_test_test.cpp @@ -16,12 +16,12 @@ #define BOOST_AUTO_TEST_MAIN #include -BOOST_AUTO_UNIT_TEST( test1 ) +BOOST_AUTO_TEST_CASE( test1 ) { BOOST_CHECK( true ); } -BOOST_AUTO_UNIT_TEST( test2 ) +BOOST_AUTO_TEST_CASE( test2 ) { BOOST_CHECK( true ); } @@ -32,6 +32,9 @@ BOOST_AUTO_UNIT_TEST( test2 ) // Revision History : // // $Log$ +// Revision 1.9 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.8 2004/05/27 06:30:48 rogeeff // no message // diff --git a/test/auto_unit_test_test_mult1.cpp b/test/auto_unit_test_test_mult1.cpp index 01967528..c15fa043 100644 --- a/test/auto_unit_test_test_mult1.cpp +++ b/test/auto_unit_test_test_mult1.cpp @@ -16,7 +16,7 @@ #define BOOST_AUTO_TEST_MAIN #include -BOOST_AUTO_UNIT_TEST( test ) +BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK( true ); } @@ -27,6 +27,9 @@ BOOST_AUTO_UNIT_TEST( test ) // Revision History : // // $Log$ +// Revision 1.6 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.5 2004/05/27 06:30:48 rogeeff // no message // diff --git a/test/auto_unit_test_test_mult2.cpp b/test/auto_unit_test_test_mult2.cpp index 233af8b9..851b1291 100644 --- a/test/auto_unit_test_test_mult2.cpp +++ b/test/auto_unit_test_test_mult2.cpp @@ -15,7 +15,7 @@ // Boost.Test #include -BOOST_AUTO_UNIT_TEST( test ) +BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK( true ); } @@ -26,6 +26,9 @@ BOOST_AUTO_UNIT_TEST( test ) // Revision History : // // $Log$ +// Revision 1.6 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.5 2004/05/27 06:30:48 rogeeff // no message // diff --git a/test/basic_cstring_test.cpp b/test/basic_cstring_test.cpp index 893a631c..7dad8b70 100644 --- a/test/basic_cstring_test.cpp +++ b/test/basic_cstring_test.cpp @@ -36,7 +36,6 @@ using utf::const_string; #include #include #include -#include namespace mpl = boost::mpl; @@ -87,11 +86,8 @@ test_string( CharT* = 0 ) //____________________________________________________________________________// -template -void constructors_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( constructors_test, CharT ) { - BOOST_MESSAGE( "Let's run \"&constructors_test\"<" << typeid(CharT).name() << ">" ); - { utf::basic_cstring bcs; BOOST_CHECK_EQUAL( bcs.size(), 0 ); @@ -136,12 +132,9 @@ void constructors_test( CharT* = 0 ) } } -BOOST_META_FUNC_TEST_CASE( constructors_test ); - //____________________________________________________________________________// -template -void constructors_std_string_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( constructors_std_string_test, CharT ) { typedef typename utf::basic_cstring::traits_type traits; @@ -154,13 +147,11 @@ void constructors_std_string_test( CharT* = 0 ) } -BOOST_META_FUNC_TEST_CASE( constructors_std_string_test ); - //____________________________________________________________________________// void array_construction_test() { -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x600) +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x600)) const_string bcs_array[] = { "str1", "str2" }; BOOST_CHECK_EQUAL( const_string::traits_type::compare( bcs_array[0].begin(), "str1", bcs_array[0].size() ), 0 ); @@ -173,8 +164,7 @@ void array_construction_test() //____________________________________________________________________________// -template -void data_access_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( data_access_test, CharT ) { typedef typename utf::basic_cstring::traits_type traits_type; @@ -199,12 +189,9 @@ void data_access_test( CharT* = 0 ) BOOST_CHECK_EQUAL( utf::last_char( utf::basic_cstring() ), 0 ); } -BOOST_META_FUNC_TEST_CASE( data_access_test ); - //____________________________________________________________________________// -template -void size_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( size_test, CharT ) { utf::basic_cstring bcs1; @@ -228,12 +215,9 @@ void size_test( CharT* = 0 ) BOOST_CHECK_EQUAL( bcs1.size(), 3 ); } -BOOST_META_FUNC_TEST_CASE( size_test ); - //____________________________________________________________________________// -template -void asignment_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( asignment_test, CharT ) { typedef typename utf::basic_cstring::traits_type traits_type; @@ -261,12 +245,9 @@ void asignment_test( CharT* = 0 ) BOOST_CHECK_EQUAL( traits_type::compare( bcs2.begin(), LITERAL( "_st" ), bcs2.size() ), 0 ); } -BOOST_META_FUNC_TEST_CASE( asignment_test ); - //____________________________________________________________________________// -template -void asignment_std_string_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( asignment_std_string_test, CharT ) { typedef typename utf::basic_cstring::traits_type traits_type; @@ -283,12 +264,9 @@ void asignment_std_string_test( CharT* = 0 ) BOOST_CHECK_EQUAL( traits_type::compare( bcs1.begin(), LITERAL( "es" ), bcs1.size() ), 0 ); } -BOOST_META_FUNC_TEST_CASE( asignment_std_string_test ); - //____________________________________________________________________________// -template -void comparison_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( comparison_test, CharT ) { utf::basic_cstring bcs1( TEST_STRING ); utf::basic_cstring bcs2( TEST_STRING ); @@ -309,12 +287,9 @@ void comparison_test( CharT* = 0 ) BOOST_CHECK( utf::case_ins_eq( bcs1, bcs3 ) ); } -BOOST_META_FUNC_TEST_CASE( comparison_test ); - //____________________________________________________________________________// -template -void comparison_std_string_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( comparison_std_string_test, CharT ) { utf::basic_cstring bcs1( TEST_STRING ); typename utf::basic_cstring::std_string l( TEST_STRING ); @@ -332,12 +307,9 @@ void comparison_std_string_test( CharT* = 0 ) #endif } -BOOST_META_FUNC_TEST_CASE( comparison_std_string_test ); - //____________________________________________________________________________// -template -void ordering_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( ordering_test, CharT ) { LOCAL_DEF( bcs1, "aBcd" ); LOCAL_DEF( bcs2, "aBbdd" ); @@ -353,12 +325,9 @@ void ordering_test( CharT* = 0 ) BOOST_CHECK( cil( bcs4, bcs1 ) ); } -BOOST_META_FUNC_TEST_CASE( ordering_test ); - //____________________________________________________________________________// -template -void trim_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( trim_test, CharT ) { LOCAL_DEF( bcs0, "tes" ); @@ -408,12 +377,9 @@ void trim_test( CharT* = 0 ) BOOST_CHECK_EQUAL( bcs3, LITERAL( "abcd" ) ); } -BOOST_META_FUNC_TEST_CASE( trim_test ); - //____________________________________________________________________________// -template -void io_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( io_test, CharT ) { utf::basic_cstring bcs1( TEST_STRING ); bcs1.trim_right( 7 ); @@ -430,12 +396,9 @@ void io_test( CharT* = 0 ) BOOST_CHECK( ostr.is_equal( "test " ) ); } -BOOST_META_FUNC_TEST_CASE( io_test ); - //____________________________________________________________________________// -template -void find_test( CharT* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( find_test, CharT ) { utf::basic_cstring bcs1( TEST_STRING ); @@ -460,8 +423,6 @@ void find_test( CharT* = 0 ) BOOST_CHECK_EQUAL( bcs1.rfind( LITERAL( "tst" ) ), utf::basic_cstring::npos ); } -BOOST_META_FUNC_TEST_CASE( find_test ); - //____________________________________________________________________________// void const_conversion() @@ -484,21 +445,21 @@ init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { utf::test_suite* test= BOOST_TEST_SUITE("basic_cstring test"); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( constructors_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( constructors_test, char_types ) ); #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( constructors_std_string_test, base_const_char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( asignment_std_string_test, base_const_char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( comparison_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( constructors_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( asignment_std_string_test, base_const_char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( comparison_std_string_test, base_const_char_types ) ); #endif test->add( BOOST_TEST_CASE( array_construction_test ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( data_access_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( size_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( asignment_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( comparison_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( ordering_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( trim_test, char_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( io_test, io_test_types ) ); - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( find_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( data_access_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( size_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( asignment_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( comparison_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( ordering_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( trim_test, char_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( io_test, io_test_types ) ); + test->add( BOOST_TEST_CASE_TEMPLATE( find_test, char_types ) ); test->add( BOOST_TEST_CASE( &const_conversion ) ); return test; @@ -508,6 +469,9 @@ init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) // History : // // $Log$ +// Revision 1.10 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.9 2005/01/30 03:35:55 rogeeff // no message // diff --git a/test/custom_exception_test.cpp b/test/custom_exception_test.cpp index 8f169726..afa73711 100644 --- a/test/custom_exception_test.cpp +++ b/test/custom_exception_test.cpp @@ -14,6 +14,7 @@ // Boost.Test #include +#include using namespace boost::unit_test; //____________________________________________________________________________// @@ -48,7 +49,7 @@ void my_exception1_translator( my_exception1 ) void throw_my_exception2() { - throw my_exception1( 89 ); + throw my_exception2( 89 ); } void my_exception2_translator( my_exception2 ) @@ -62,8 +63,8 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { test_suite* test = BOOST_TEST_SUITE("custom_exception_test"); - register_exception_translator( &my_exception1_translator ); - register_exception_translator( &my_exception2_translator ); + unit_test_monitor.register_exception_translator( &my_exception1_translator ); + unit_test_monitor.register_exception_translator( &my_exception2_translator ); test->add( BOOST_TEST_CASE( &throw_my_exception1 ) ); test->add( BOOST_TEST_CASE( &throw_my_exception2 ) ); @@ -77,6 +78,9 @@ init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { // Revision History : // // $Log$ +// Revision 1.6 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.5 2004/05/21 06:26:10 rogeeff // licence update // diff --git a/test/errors_handling_test.cpp b/test/errors_handling_test.cpp index 6d57c889..9911eefd 100644 --- a/test/errors_handling_test.cpp +++ b/test/errors_handling_test.cpp @@ -1,7 +1,7 @@ // (C) Copyright Gennadiy Rozental 2001-2004. // (C) Copyright Beman Dawes 2001. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -17,243 +17,173 @@ // Boost.Test #include -#include #include #include +#include #include #include +#include using namespace boost::unit_test; using namespace boost::test_tools; // STL #include +#include -struct this_test_log_formatter : public boost::unit_test::output::compiler_log_formatter +namespace { + +struct this_test_log_formatter : public boost::unit_test::output::compiler_log_formatter { void print_prefix( std::ostream& output, boost::unit_test::const_string, std::size_t line ) { output << line << ": "; } - void test_case_exit( std::ostream& output, test_case const& tc, long testing_time_in_mks ) + void test_unit_finish( std::ostream& output, test_unit const& tu, unsigned long elapsed ) { - output << "Leaving test " << ( tc.p_type ? "case" : "suite" ) << " \"" << tc.p_name << "\""; + output << "Leaving test " << tu.p_type_name << " \"" << tu.p_name << "\"" << std::endl; } }; //____________________________________________________________________________// -namespace { - enum error_type_enum { - et_begin, - et_none = et_begin, - et_user, - et_cpp_exception, - et_system, - et_fatal_user, - et_fatal_system, - et_end - } error_type; +char const* log_level_name[] = { + "log_successful_tests", + "log_test_suites", + "log_messages", + "log_warnings", + "log_all_errors", + "log_cpp_exception_errors", + "log_system_errors", + "log_fatal_errors", + "log_nothing" +}; - char const* error_type_name[] = { "no error", "user error", "cpp exception", " system error", "fatal user error", "fatal system error" }; +enum error_type_enum { + et_begin, + et_none = et_begin, + et_message, + et_warning, + et_user, + et_cpp_exception, +#ifdef __GNUC__ + et_fatal_user, +#else + et_system, + et_fatal_user, + et_fatal_system, +#endif + et_end +} error_type; - int divide_by_zero = 0; +char const* error_type_name[] = { + "no error", "user message", "user warning", + "user non-fatal error", "cpp exception", " system error", + "user fatal error", "system fatal error" +}; - // will cause an error coresponding to the current error_type; - void error_on_demand() - { - switch( error_type ) { - case et_none: - BOOST_MESSAGE( "error_on_demand() BOOST_MESSAGE" ); - break; +int divide_by_zero = 0; - case et_user: - unit_test_result::instance().increase_expected_failures(); - BOOST_ERROR( "error_on_demand() BOOST_ERROR" ); - break; +void error_on_demand() +{ + switch( error_type ) { + case et_none: + BOOST_CHECK_MESSAGE( divide_by_zero == 0, "no error" ); + break; - case et_fatal_user: - unit_test_result::instance().increase_expected_failures(); - BOOST_FAIL( "error_on_demand() BOOST_FAIL" ); + case et_message: + BOOST_MESSAGE( "message" ); + break; + + case et_warning: + BOOST_WARN_MESSAGE( divide_by_zero != 0, "warning" ); + break; + + case et_user: + BOOST_ERROR( "non-fatal error" ); + break; + + case et_fatal_user: + BOOST_FAIL( "fatal error" ); + + BOOST_ERROR( "Should never reach this code!" ); + break; + + case et_cpp_exception: + BOOST_CHECKPOINT( "error_on_demand() throw runtime_error" ); + throw std::runtime_error( "test std::runtime error what() message" ); + +#ifndef __GNUC__ + case et_system: + BOOST_CHECKPOINT( "error_on_demand() divide by zero" ); + divide_by_zero = 1 / divide_by_zero; + break; + + case et_fatal_system: + BOOST_CHECKPOINT( "write to an invalid address" ); + { + int* p = 0; + *p = 0; BOOST_ERROR( "Should never reach this code!" ); - break; - - case et_cpp_exception: - BOOST_CHECKPOINT( "error_on_demand() throw runtime_error" ); - throw std::runtime_error( "test std::runtime error what() message" ); - - case et_system: - BOOST_CHECKPOINT( "error_on_demand() divide by zero" ); - divide_by_zero = 1 / divide_by_zero; - break; - - case et_fatal_system: - BOOST_CHECKPOINT( "error_on_demand() write to an invalid address" ); - { - int* p = 0; - *p = 0; - - BOOST_ERROR( "Should never reach this code!" ); - } - break; - - default: - BOOST_ERROR( "Should never reach this code!" ); } - return; + break; +#endif + default: + BOOST_ERROR( "Should never reach this code!" ); } + return; +} - enum test_case_type_enum { - tct_begin, - tct_free_function = tct_begin, - tct_user_test_case, - tct_param_free_function, - tct_param_user_test_case, - tct_end - } test_case_type; - - char const* test_case_type_name[] = { "free function", - "user test case", - "parameterized free function", - "parameterized user test case" - }; - - // simulated user classes to be tested --------------------------------// - - // user test cases ----------------------------------------------------// - - struct bad_test - { - void test() - { - BOOST_MESSAGE( "(user test case)" ); - error_on_demand(); - } - void test_param( int ) - { - BOOST_MESSAGE( "(parameterized user test case)" ); - error_on_demand(); - } - }; - - // free function tests ---------------------------------------------------// - - void bad_function() - { - BOOST_MESSAGE( "(free function)" ); - error_on_demand(); - } - - void bad_function_param( int ) - { - BOOST_MESSAGE( "(parameterized free function)" ); - error_on_demand(); - } - - int params[] = { 0 }; - -} // unnamed namespace +} // local namespace //____________________________________________________________________________// int test_main( int argc, char * argv[] ) { - - bool match_or_save = retrieve_framework_parameter( SAVE_TEST_PATTERN, &argc, argv ) != "yes"; - #define PATTERN_FILE_NAME "errors_handling_test.pattern" - - std::string pattern_file_name( argc == 1 - ? (match_or_save ? "./test_files/" PATTERN_FILE_NAME : PATTERN_FILE_NAME) - : argv[1] ); + std::string pattern_file_name( + argc == 1 ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./test_files/" PATTERN_FILE_NAME ) + : argv[1] ); #ifdef __GNUC__ - pattern_file_name.append( "2" ); + pattern_file_name += "2"; #endif - output_test_stream output( pattern_file_name, match_or_save ); + output_test_stream test_output( pattern_file_name, !runtime_config::save_pattern() ); - unit_test_log.set_stream( output ); - unit_test_log.set_formatter( new this_test_log_formatter ); - - boost::shared_ptr bad_test_instance( new bad_test ); + test_case* test = BOOST_TEST_CASE( &error_on_demand ); // for each log level for( log_level level = log_successful_tests; - level <= log_nothing; + level <= log_nothing; level = static_cast(level+1) ) { - unit_test_log.set_threshold_level( level ); // for each error type for( error_type = et_begin; error_type != et_end; error_type = static_cast(error_type+1) ) { -#ifdef __GNUC__ - if( error_type == et_system || error_type == et_fatal_system ) - continue; -#endif - // for each error location - for( test_case_type = tct_begin; - test_case_type != tct_end; - test_case_type = static_cast(test_case_type+1) ) - { - output << "\n===========================\n\n" - << "log level: " << int(level) << ';' - << " error type: " << error_type_name[error_type] << ';' - << " test case type: " << test_case_type_name[test_case_type] << ';'<< std::endl; + test_output << "\n===========================\n" + << "log level: " << log_level_name[level] << ';' + << " error type: " << error_type_name[error_type] << ";\n" << std::endl; - // In typical user code, multiple test cases would be added to a single - // test suite. But for testing the unit test code itself, it is easier - // to isolate each case in its own test suite. - test_suite test( "Errors handling test" ); - switch( test_case_type ) { - case tct_free_function: - test.add( BOOST_TEST_CASE( &bad_function ) ); - break; - case tct_user_test_case: - test.add( BOOST_CLASS_TEST_CASE( &bad_test::test, bad_test_instance ) ); - break; - case tct_param_free_function: -// Borland bug workaround -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) - test.add( boost::unit_test::create_test_case( &bad_function_param, std::string( "bad_function_param" ), (int*)params, params+1 ) ); -#else - test.add( BOOST_PARAM_TEST_CASE( &bad_function_param, (int*)params, params+1 ) ); -#endif - break; - case tct_param_user_test_case: -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) - test.add( boost::unit_test::create_test_case( &bad_test::test_param, std::string( "bad_test::test_param" ), bad_test_instance, (int*)params, params+1 ) ); -#else - test.add( BOOST_PARAM_CLASS_TEST_CASE( &bad_test::test_param, bad_test_instance, (int*)params, params+1 ) ); -#endif - break; - default: - continue; - } + unit_test_log.set_stream( test_output ); + unit_test_log.set_formatter( new this_test_log_formatter ); + unit_test_log.set_threshold_level( level ); + framework::run( test ); - { - unit_test_result_saver saver; - unit_test_log.start(); - unit_test_log.header( 1 ); - test.run(); - unit_test_log.finish( 1 ); - } - - unit_test_log.set_threshold_level( log_all_errors ); - BOOST_CHECK( output.match_pattern() ); - unit_test_log.set_threshold_level( level ); - } + unit_test_log.set_stream( std::cout ); + unit_test_log.set_format( runtime_config::log_format() ); + unit_test_log.set_threshold_level( runtime_config::log_level() != invalid_log_level + ? runtime_config::log_level() + : log_all_errors ); + BOOST_CHECK( test_output.match_pattern() ); } } - unit_test_result::instance().short_report( output ); - output.match_pattern(); - return 0; } // main @@ -263,47 +193,9 @@ test_main( int argc, char * argv[] ) // Revision History : // // $Log$ -// Revision 1.28 2005/02/02 12:06:52 rogeeff -// *** empty log message *** +// Revision 1.29 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // -// Revision 1.27 2005/01/30 03:35:55 rogeeff -// no message -// -// Revision 1.25 2005/01/18 08:30:08 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls -// -// Revision 1.24 2004/10/05 04:27:09 rogeeff -// 31 length fix -// -// Revision 1.23 2004/10/05 01:32:09 rogeeff -// file/directory renaming for the sake of CD burning -// -// Revision 1.22 2004/10/01 10:55:43 rogeeff -// some test errors workarrounds -// -// Revision 1.21 2004/06/07 07:34:23 rogeeff -// detail namespace renamed -// -// Revision 1.20 2004/05/27 06:30:48 rogeeff -// no message -// -// Revision 1.19 2004/05/21 06:26:10 rogeeff -// licence update -// -// Revision 1.18 2004/05/11 11:05:06 rogeeff -// basic_cstring introduced and used everywhere -// class properties reworked -// namespace names shortened -// -// Revision 1.17 2003/12/01 00:42:37 rogeeff -// prerelease cleaning -// - // *************************************************************************** // EOF diff --git a/test/fixed_mapping_test.cpp b/test/fixed_mapping_test.cpp index 70ba6c5a..2aefe52b 100644 --- a/test/fixed_mapping_test.cpp +++ b/test/fixed_mapping_test.cpp @@ -26,7 +26,7 @@ using utf::const_string; //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_default_compare ) +BOOST_AUTO_TEST_CASE( test_default_compare ) { utf::fixed_mapping test_mapping( "Key1", 1, @@ -54,7 +54,7 @@ BOOST_AUTO_UNIT_TEST( test_default_compare ) //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_custom_compare ) +BOOST_AUTO_TEST_CASE( test_custom_compare ) { utf::fixed_mapping > test_mapping( "Key1", 1, @@ -82,6 +82,9 @@ BOOST_AUTO_UNIT_TEST( test_custom_compare ) // History : // // $Log$ +// Revision 1.6 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // Revision 1.5 2005/01/30 03:35:55 rogeeff // no message // diff --git a/test/parameterized_test_test.cpp b/test/parameterized_test_test.cpp index 3bb2bd6b..0a81d0cd 100644 --- a/test/parameterized_test_test.cpp +++ b/test/parameterized_test_test.cpp @@ -13,10 +13,13 @@ // *************************************************************************** // Boost.Test -#include -#include +#define BOOST_AUTO_TEST_MAIN +#include +#include #include +#include #include +#include #if BOOST_WORKAROUND( __GNUC__, < 3 ) #include typedef boost::test_tools::output_test_stream onullstream_type; @@ -25,7 +28,7 @@ typedef boost::test_tools::output_test_stream onullstream_type; typedef boost::onullstream onullstream_type; #endif -namespace utf=boost::unit_test; +namespace ut = boost::unit_test; // BOOST #include @@ -53,144 +56,155 @@ void test1( int i ) //____________________________________________________________________________// +BOOST_AUTO_TEST_CASE( test_case1 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)) -#define BOOST_PARAM_TEST_CASE__( arg1, arg2, arg3 ) \ - boost::unit_test::create_test_case( (arg1), std::string( "" ), (arg2), (arg3) ) -#else -#define BOOST_PARAM_TEST_CASE__( arg1, arg2, arg3 ) BOOST_PARAM_TEST_CASE( arg1, arg2, arg3 ) -#endif - -int test_main( int, char* [] ) { - utf::counter_t num_of_failures; - bool exception_caught; - bool passed; - onullstream_type null_output; - boost::scoped_ptr test; - - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 2, 2, 2 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK( tr.p_assertions_failed == 0 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK( num_of_failures == 0 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case2 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 1, 2, 2 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK( tr.p_assertions_failed == 1 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK( num_of_failures == 1 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case3 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 1, 1, 2 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)2 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)2 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case4 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 1, 1, 1 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test0, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)3 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)3 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case5 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 6, 6, 6 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - passed = utf::unit_test_result::instance().has_passed(); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)0 ); + BOOST_CHECK( !tr.p_aborted ); + BOOST_CHECK( !tr.passed() ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)0 ); - BOOST_CHECK( !exception_caught ); - BOOST_CHECK( !passed ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case6 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 0, 3, 9 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)2 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)2 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case7 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 2, 3, 9 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)2 ); + BOOST_CHECK( !tr.p_aborted ); +} - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)2 ); - BOOST_CHECK( !exception_caught ); +//____________________________________________________________________________// - utf::unit_test_log.set_stream( null_output ); - { - utf::unit_test_result_saver saver; +BOOST_AUTO_TEST_CASE( test_case8 ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + + ut::unit_test_log.set_stream( null_output ); int test_data[] = { 3, 2, 6 }; - test.reset( BOOST_PARAM_TEST_CASE__( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); + test->add( BOOST_PARAM_TEST_CASE( &test1, (int*)test_data, (int*)test_data + sizeof(test_data)/sizeof(int) ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - utf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } - - utf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)1 ); - BOOST_CHECK( !exception_caught ); - - return 0; + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)1 ); + BOOST_CHECK( !tr.p_aborted ); } //____________________________________________________________________________// @@ -199,35 +213,9 @@ int test_main( int, char* [] ) { // Revision History : // // $Log$ -// Revision 1.18 2005/01/31 20:01:39 rogeeff -// use BOOST_WORKAROUND +// Revision 1.19 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // -// Revision 1.17 2005/01/30 03:35:55 rogeeff -// no message -// -// Revision 1.15 2005/01/18 08:30:09 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls -// -// Revision 1.14 2004/05/21 06:26:10 rogeeff -// licence update -// -// Revision 1.13 2004/05/11 11:05:06 rogeeff -// basic_cstring introduced and used everywhere -// class properties reworked -// namespace names shortened -// -// Revision 1.12 2003/12/03 01:22:40 rogeeff -// *** empty log message *** -// -// Revision 1.11 2003/12/01 00:42:37 rogeeff -// prerelease cleaning -// - // *************************************************************************** // EOF diff --git a/test/result_report_test.cpp b/test/result_report_test.cpp index 874b627e..05b0100a 100644 --- a/test/result_report_test.cpp +++ b/test/result_report_test.cpp @@ -14,11 +14,12 @@ // *************************************************************************** // Boost.Test -#include #include +#include #include #include #include +#include #include #if BOOST_WORKAROUND( __GNUC__, < 3 ) typedef boost::test_tools::output_test_stream onullstream_type; @@ -27,65 +28,84 @@ typedef boost::test_tools::output_test_stream onullstream_type; typedef boost::onullstream onullstream_type; #endif -using boost::test_tools::output_test_stream; -using namespace boost::unit_test; - // BOOST #include // STL #include -#include -#include -#include + +using boost::test_tools::output_test_stream; +using namespace boost::unit_test; //____________________________________________________________________________// void good_foo() {} + void bad_foo() { onullstream_type null_out; unit_test_log.set_stream( null_out ); - BOOST_ERROR( "Sure" ); + BOOST_ERROR( "" ); + unit_test_log.set_stream( std::cout ); +} + +void very_bad_foo() { + onullstream_type null_out; + unit_test_log.set_stream( null_out ); + BOOST_FAIL( "" ); unit_test_log.set_stream( std::cout ); } //____________________________________________________________________________// -void check( output_test_stream& output, const_string report_format ) +void check( output_test_stream& output, output_format report_format, test_unit_id id ) { - unit_test_result::instance().set_report_format( report_format ); + results_reporter::set_format( report_format ); - unit_test_result::instance().confirmation_report( output ); - output << "*************************************************************************\n\n"; + results_reporter::confirmation_report( id ); + output << "*************************************************************************\n"; BOOST_CHECK( output.match_pattern() ); - unit_test_result::instance().short_report( output ); - output << "*************************************************************************\n\n"; + results_reporter::short_report( id ); + output << "*************************************************************************\n"; BOOST_CHECK( output.match_pattern() ); - unit_test_result::instance().detailed_report( output ); - output << "*************************************************************************\n\n"; + results_reporter::detailed_report( id ); + output << "*************************************************************************\n"; BOOST_CHECK( output.match_pattern() ); } //____________________________________________________________________________// -void check( output_test_stream& output ) +void check( output_test_stream& output, test_unit_id id ) { - check( output, "HRF" ); - check( output, "XML" ); + check( output, CLF, id ); + check( output, XML, id ); } //____________________________________________________________________________// +struct guard { + ~guard() + { + results_reporter::set_stream( std::cerr ); + results_reporter::set_format( runtime_config::report_format() ); + } +}; + +//____________________________________________________________________________// + int test_main( int argc, char* argv[] ) { - bool match_or_save = retrieve_framework_parameter( SAVE_TEST_PATTERN, &argc, argv ) != "yes"; - const_string pattern_file_name( argc > 1 ? argv[1] : "./test_files/result_report_test.pattern" ); + guard G; + +#define PATTERN_FILE_NAME "result_report_test.pattern" + std::string pattern_file_name( + argc == 1 ? (runtime_config::save_pattern() ? PATTERN_FILE_NAME : "./test_files/" PATTERN_FILE_NAME ) + : argv[1] ); + + output_test_stream test_output( pattern_file_name, !runtime_config::save_pattern() ); - output_test_stream output( pattern_file_name, match_or_save ); - test_suite* ts_0 = BOOST_TEST_SUITE( "0 test cases inside" ); test_suite* ts_1 = BOOST_TEST_SUITE( "1 test cases inside" ); @@ -99,46 +119,50 @@ test_main( int argc, char* argv[] ) ts_2->add( BOOST_TEST_CASE( bad_foo ), 1 ); test_suite* ts_3 = BOOST_TEST_SUITE( "3 test cases inside" ); - ts_3->add( BOOST_TEST_CASE( good_foo ) ); - ts_3->add( BOOST_TEST_CASE( good_foo ) ); - ts_3->add( BOOST_TEST_CASE( bad_foo ), 1 ); + ts_3->add( BOOST_TEST_CASE( bad_foo ) ); + test_case* tc1 = BOOST_TEST_CASE( very_bad_foo ); + ts_3->add( tc1 ); + test_case* tc2 = BOOST_TEST_CASE( bad_foo ); + ts_3->add( tc2 ); + tc2->depends_on( tc1 ); - test_suite ts_main( "Fake Test Suite Hierarchy" ); - ts_main.add( ts_0 ); - ts_main.add( ts_1 ); - ts_main.add( ts_2 ); - ts_main.add( ts_3 ); + test_suite* ts_main = BOOST_TEST_SUITE( "Fake Test Suite Hierarchy" ); + ts_main->add( ts_0 ); + ts_main->add( ts_1 ); + ts_main->add( ts_2 ); + ts_main->add( ts_3 ); - check( output ); + results_reporter::set_stream( test_output ); + framework::run( ts_0 ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_0->p_id ); - ts_0->run(); - check( output ); + results_reporter::set_stream( test_output ); + framework::run( ts_1 ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_1->p_id ); - ts_1->run(); - check( output ); + results_reporter::set_stream( test_output ); + framework::run( ts_1b ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_1b->p_id ); - unit_test_result::instance().increase_expected_failures(); - ts_2->run(); - check( output ); + results_reporter::set_stream( test_output ); + framework::run( ts_2 ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_2->p_id ); - unit_test_result::instance().increase_expected_failures(); - ts_1b->run(); - check( output ); + results_reporter::set_stream( test_output ); + framework::run( ts_3 ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_3->p_id ); - unit_test_result::instance().increase_expected_failures(); - ts_3->run(); - check( output ); + ts_3->depends_on( tc1 ); - unit_test_result::instance().increase_expected_failures( 2 ); - ts_main.run(); - - check( output ); - - const_string output_format = retrieve_framework_parameter( OUTPUT_FORMAT, &argc, argv ); - - if( output_format.empty() ) { - unit_test_result::set_report_format( retrieve_framework_parameter( REPORT_FORMAT, &argc, argv ) ); - } + results_reporter::set_stream( test_output ); + framework::run( ts_main ); + results_reporter::set_stream( std::cout ); + check( test_output, ts_main->p_id ); return 0; } @@ -149,30 +173,8 @@ test_main( int argc, char* argv[] ) // Revision History : // // $Log$ -// Revision 1.19 2005/01/31 20:03:28 rogeeff -// use BOOST_WORKAROUND -// -// Revision 1.18 2005/01/30 03:35:55 rogeeff -// no message -// -// Revision 1.16 2005/01/18 08:30:09 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls -// -// Revision 1.15 2004/05/27 06:30:48 rogeeff -// no message -// -// Revision 1.14 2004/05/21 06:26:10 rogeeff -// licence update -// -// Revision 1.13 2004/05/11 11:05:06 rogeeff -// basic_cstring introduced and used everywhere -// class properties reworked -// namespace names shortened +// Revision 1.20 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // // *************************************************************************** diff --git a/test/test_case_template_test.cpp b/test/test_case_template_test.cpp index 3195c5ab..f07ed261 100644 --- a/test/test_case_template_test.cpp +++ b/test/test_case_template_test.cpp @@ -13,11 +13,13 @@ // *************************************************************************** // Boost.Test -#include -#include +#define BOOST_AUTO_TEST_MAIN +#include #include #include +#include #include +#include #if BOOST_WORKAROUND( __GNUC__, < 3 ) #include @@ -32,7 +34,7 @@ typedef boost::onullstream onullstream_type; #include #include -namespace tf = boost::unit_test; +namespace ut = boost::unit_test; namespace mpl = boost::mpl; // STL @@ -40,114 +42,104 @@ namespace mpl = boost::mpl; //____________________________________________________________________________// -template -void test0( Number* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test0, Number ) { BOOST_CHECK_EQUAL( 2, (int const)Number::value ); } -BOOST_META_FUNC_TEST_CASE( test0 ); - //____________________________________________________________________________// -template -void test1( Number* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test1, Number ) { BOOST_CHECK_EQUAL( 6, (int const)Number::value ); - BOOST_REQUIRE( 2 <= (int const)Number::value ); - BOOST_CHECK_EQUAL( 3, (int const)Number::value ); } -BOOST_META_FUNC_TEST_CASE( test1 ); - //____________________________________________________________________________// -template -void test2( Number* = 0 ) +BOOST_TEST_CASE_TEMPLATE_FUNCTION( test2, Number ) { throw Number(); } -BOOST_META_FUNC_TEST_CASE( test2 ); +//____________________________________________________________________________// + +BOOST_AUTO_TEST_CASE( test0_only_2 ) +{ + onullstream_type null_output; + + typedef boost::mpl::list_c only_2; + ut::unit_test_log.set_stream( null_output ); + + ut::test_suite* test = BOOST_TEST_SUITE( "" ); + test->add( BOOST_TEST_CASE_TEMPLATE( test0, only_2 ) ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); + + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)0 ); + BOOST_CHECK( !tr.p_aborted ); +} //____________________________________________________________________________// -int test_main( int, char* [] ) +BOOST_AUTO_TEST_CASE( test0_one_to_ten ) { - tf::counter_t num_of_failures; - bool exception_caught; - onullstream_type null_output; - boost::scoped_ptr test; + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); - tf::unit_test_log.set_stream( null_output ); - - { - tf::unit_test_result_saver saver; - typedef boost::mpl::list_c only_2; - test.reset( BOOST_FUNC_TEMPLATE_TEST_CASE( test0, only_2 ) ); - - test->run(); - - tf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } - - tf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)0 ); - BOOST_CHECK( !exception_caught ); - - tf::unit_test_log.set_stream( null_output ); - - { - tf::unit_test_result_saver saver; typedef boost::mpl::range_c one_to_ten; - test.reset( BOOST_FUNC_TEMPLATE_TEST_CASE( test0, one_to_ten ) ); + ut::unit_test_log.set_stream( null_output ); + + test->add( BOOST_TEST_CASE_TEMPLATE( test0, one_to_ten ) ); - test->run(); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - tf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)9 ); + BOOST_CHECK( !tr.p_aborted ); - tf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)9 ); - BOOST_CHECK( !exception_caught ); +} - tf::unit_test_log.set_stream( null_output ); +//____________________________________________________________________________// - { - tf::unit_test_result_saver saver; - typedef boost::mpl::range_c one_to_five; - test.reset( BOOST_FUNC_TEMPLATE_TEST_CASE( test1, one_to_five ) ); +BOOST_AUTO_TEST_CASE( test1_one_to_five ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); - test->run(); + typedef boost::mpl::range_c one_to_five; + ut::unit_test_log.set_stream( null_output ); + test->add( BOOST_TEST_CASE_TEMPLATE( test1, one_to_five ) ); - tf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - } + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - tf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)7 ); - BOOST_CHECK( !exception_caught ); + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)7 ); + BOOST_CHECK( !tr.p_aborted ); +} - tf::unit_test_log.set_stream( null_output ); - bool passed = false; - { - tf::unit_test_result_saver saver; - typedef boost::mpl::range_c one_to_three; - test.reset( BOOST_FUNC_TEMPLATE_TEST_CASE( test2, one_to_three ) ); +//____________________________________________________________________________// - test->run(); +BOOST_AUTO_TEST_CASE( test2_one_to_three ) +{ + onullstream_type null_output; + ut::test_suite* test = BOOST_TEST_SUITE( "" ); - tf::unit_test_result::instance().failures_details( num_of_failures, exception_caught ); - passed = tf::unit_test_result::instance().has_passed(); - } + typedef boost::mpl::range_c one_to_three; + ut::unit_test_log.set_stream( null_output ); + test->add( BOOST_TEST_CASE_TEMPLATE( test2, one_to_three ) ); - tf::unit_test_log.set_stream( std::cout ); - BOOST_CHECK_EQUAL( num_of_failures, (std::size_t)0 ); - BOOST_CHECK( !exception_caught ); - BOOST_CHECK( !passed ); + ut::framework::run( test ); + ut::test_results const& tr = ut::results_collector.results( test->p_id ); - return 0; + ut::unit_test_log.set_stream( std::cout ); + BOOST_CHECK_EQUAL( tr.p_assertions_failed, (std::size_t)0 ); + BOOST_CHECK( !tr.p_aborted ); + BOOST_CHECK( !tr.passed() ); } //____________________________________________________________________________// @@ -156,19 +148,9 @@ int test_main( int, char* [] ) // Revision History : // // $Log$ -// Revision 1.12 2005/01/31 20:01:40 rogeeff -// use BOOST_WORKAROUND +// Revision 1.13 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // -// Revision 1.11 2005/01/30 03:35:55 rogeeff -// no message -// -// Revision 1.9 2005/01/18 08:30:09 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls // *************************************************************************** // EOF diff --git a/test/test_files/errors_handling_test.pattern b/test/test_files/errors_handling_test.pattern index 35b3e30b..75a2967f 100644 --- a/test/test_files/errors_handling_test.pattern +++ b/test/test_files/errors_handling_test.pattern @@ -1,1804 +1,426 @@ =========================== +log level: log_successful_tests; error type: no error; -log level: 0; error type: no error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +92: info: check 'no error' passed +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user message; -log level: 0; error type: no error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +message +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user warning; -log level: 0; error type: no error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +100: warning in "error_on_demand": warning +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user non-fatal error; -log level: 0; error type: no error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +104: error in "error_on_demand": non-fatal error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: cpp exception; -log level: 0; error type: user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: system error; -log level: 0; error type: user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user fatal error; -log level: 0; error type: user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +108: fatal error in "error_on_demand": fatal error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: system fatal error; -log level: 0; error type: user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address +Test is aborted +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: no error; -log level: 0; error type: cpp exception; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user message; -log level: 0; error type: cpp exception; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +message +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user warning; -log level: 0; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +100: warning in "error_on_demand": warning +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user non-fatal error; -log level: 0; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +104: error in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: cpp exception; -log level: 0; error type: system error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: system error; -log level: 0; error type: system error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user fatal error; -log level: 0; error type: system error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +108: fatal error in "error_on_demand": fatal error +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: system fatal error; -log level: 0; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address +Test is aborted +Leaving test case "error_on_demand" =========================== +log level: log_messages; error type: no error; -log level: 0; error type: fatal user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_messages; error type: user message; -log level: 0; error type: fatal user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +message =========================== +log level: log_messages; error type: user warning; -log level: 0; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +100: warning in "error_on_demand": warning =========================== +log level: log_messages; error type: user non-fatal error; -log level: 0; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_messages; error type: cpp exception; -log level: 0; error type: fatal system error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_messages; error type: system error; -log level: 0; error type: fatal system error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_messages; error type: user fatal error; -log level: 0; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_messages; error type: system fatal error; -log level: 0; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address +Test is aborted =========================== +log level: log_warnings; error type: no error; -log level: 1; error type: no error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_warnings; error type: user message; -log level: 1; error type: no error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" =========================== +log level: log_warnings; error type: user warning; -log level: 1; error type: no error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +100: warning in "error_on_demand": warning =========================== +log level: log_warnings; error type: user non-fatal error; -log level: 1; error type: no error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_warnings; error type: cpp exception; -log level: 1; error type: user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_warnings; error type: system error; -log level: 1; error type: user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_warnings; error type: user fatal error; -log level: 1; error type: user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_warnings; error type: system fatal error; -log level: 1; error type: user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address =========================== +log level: log_all_errors; error type: no error; -log level: 1; error type: cpp exception; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user message; -log level: 1; error type: cpp exception; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user warning; -log level: 1; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user non-fatal error; -log level: 1; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_all_errors; error type: cpp exception; -log level: 1; error type: system error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_all_errors; error type: system error; -log level: 1; error type: system error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_all_errors; error type: user fatal error; -log level: 1; error type: system error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_all_errors; error type: system fatal error; -log level: 1; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address =========================== +log level: log_cpp_exception_errors; error type: no error; -log level: 1; error type: fatal user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: user message; -log level: 1; error type: fatal user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: user warning; -log level: 1; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: user non-fatal error; -log level: 1; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: cpp exception; -log level: 1; error type: fatal system error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_cpp_exception_errors; error type: system error; -log level: 1; error type: fatal system error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_cpp_exception_errors; error type: user fatal error; -log level: 1; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_cpp_exception_errors; error type: system fatal error; -log level: 1; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address =========================== +log level: log_system_errors; error type: no error; -log level: 2; error type: no error; test case type: free function; -Running 1 test case... -(free function) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_system_errors; error type: user message; -log level: 2; error type: no error; test case type: user test case; -Running 1 test case... -(user test case) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_system_errors; error type: user warning; -log level: 2; error type: no error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_system_errors; error type: user non-fatal error; -log level: 2; error type: no error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_system_errors; error type: cpp exception; -log level: 2; error type: user error; test case type: free function; -Running 1 test case... -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR =========================== +log level: log_system_errors; error type: system error; -log level: 2; error type: user error; test case type: user test case; -Running 1 test case... -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR +Exception in "error_on_demand": integer divide by zero +119: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_system_errors; error type: user fatal error; -log level: 2; error type: user error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_system_errors; error type: system fatal error; -log level: 2; error type: user error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address =========================== +log level: log_fatal_errors; error type: no error; -log level: 2; error type: cpp exception; test case type: free function; -Running 1 test case... -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: user message; -log level: 2; error type: cpp exception; test case type: user test case; -Running 1 test case... -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: user warning; -log level: 2; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: user non-fatal error; -log level: 2; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: cpp exception; -log level: 2; error type: system error; test case type: free function; -Running 1 test case... -(free function) -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_fatal_errors; error type: system error; -log level: 2; error type: system error; test case type: user test case; -Running 1 test case... -(user test case) -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero =========================== +log level: log_fatal_errors; error type: user fatal error; -log level: 2; error type: system error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_fatal_errors; error type: system fatal error; -log level: 2; error type: system error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero +Exception in "error_on_demand": memory access violation +124: last checkpoint: write to an invalid address =========================== +log level: log_nothing; error type: no error; -log level: 2; error type: fatal user error; test case type: free function; -Running 1 test case... -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL =========================== +log level: log_nothing; error type: user message; -log level: 2; error type: fatal user error; test case type: user test case; -Running 1 test case... -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL =========================== +log level: log_nothing; error type: user warning; -log level: 2; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL =========================== +log level: log_nothing; error type: user non-fatal error; -log level: 2; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL =========================== +log level: log_nothing; error type: cpp exception; -log level: 2; error type: fatal system error; test case type: free function; -Running 1 test case... -(free function) -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted =========================== +log level: log_nothing; error type: system error; -log level: 2; error type: fatal system error; test case type: user test case; -Running 1 test case... -(user test case) -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted =========================== +log level: log_nothing; error type: user fatal error; -log level: 2; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted =========================== +log level: log_nothing; error type: system fatal error; -log level: 2; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted =========================== +log level: no error; error type: no error; -log level: 3; error type: no error; test case type: free function; -Running 1 test case... =========================== +log level: no error; error type: user message; -log level: 3; error type: no error; test case type: user test case; -Running 1 test case... =========================== +log level: no error; error type: user warning; -log level: 3; error type: no error; test case type: parameterized free function; -Running 1 test case... =========================== +log level: no error; error type: user non-fatal error; -log level: 3; error type: no error; test case type: parameterized user test case; -Running 1 test case... =========================== +log level: no error; error type: cpp exception; -log level: 3; error type: user error; test case type: free function; -Running 1 test case... -73: error in "bad_function": error_on_demand() BOOST_ERROR =========================== +log level: no error; error type: system error; -log level: 3; error type: user error; test case type: user test case; -Running 1 test case... -73: error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== +log level: no error; error type: user fatal error; -log level: 3; error type: user error; test case type: parameterized free function; -Running 1 test case... -73: error in "bad_function_param": error_on_demand() BOOST_ERROR =========================== +log level: no error; error type: system fatal error; -log level: 3; error type: user error; test case type: parameterized user test case; -Running 1 test case... -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 3; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 3; error type: system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 3; error type: system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 3; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 3; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted - -=========================== - -log level: 3; error type: fatal system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted - -=========================== - -log level: 3; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted - -=========================== - -log level: 3; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted - -=========================== - -log level: 4; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 4; error type: user error; test case type: free function; -Running 1 test case... -73: error in "bad_function": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: user test case; -Running 1 test case... -73: error in "bad_test::test": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: parameterized free function; -Running 1 test case... -73: error in "bad_function_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: parameterized user test case; -Running 1 test case... -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 4; error type: system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 4; error type: system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 4; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 4; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted - -=========================== - -log level: 4; error type: fatal system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted - -=========================== - -log level: 4; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted - -=========================== - -log level: 4; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted - -=========================== - -log level: 5; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 5; error type: system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 5; error type: system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 5; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 5; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted - -=========================== - -log level: 5; error type: fatal system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted - -=========================== - -log level: 5; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted - -=========================== - -log level: 5; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted - -=========================== - -log level: 6; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 6; error type: system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 6; error type: system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 6; error type: system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": integer divide by zero -88: last checkpoint: error_on_demand() divide by zero - -=========================== - -log level: 6; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted - -=========================== - -log level: 6; error type: fatal system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted - -=========================== - -log level: 6; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted - -=========================== - -log level: 6; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted - -=========================== - -log level: 7; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: system error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: system error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: system error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: system error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal system error; test case type: free function; -Running 1 test case... -Exception in "bad_function": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function": Testing aborted - -=========================== - -log level: 7; error type: fatal system error; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test": Testing aborted - -=========================== - -log level: 7; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_function_param": Testing aborted - -=========================== - -log level: 7; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": memory access violation -93: last checkpoint: error_on_demand() write to an invalid address -176: fatal error in "bad_test::test_param": Testing aborted - -=========================== - -log level: 8; error type: no error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: system error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: system error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: system error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: system error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal system error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal system error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal system error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal system error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 9; error type: no error; test case type: free function; - -=========================== - -log level: 9; error type: no error; test case type: user test case; - -=========================== - -log level: 9; error type: no error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: no error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: user error; test case type: free function; - -=========================== - -log level: 9; error type: user error; test case type: user test case; - -=========================== - -log level: 9; error type: user error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: user error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: cpp exception; test case type: free function; - -=========================== - -log level: 9; error type: cpp exception; test case type: user test case; - -=========================== - -log level: 9; error type: cpp exception; test case type: parameterized free function; - -=========================== - -log level: 9; error type: cpp exception; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: system error; test case type: free function; - -=========================== - -log level: 9; error type: system error; test case type: user test case; - -=========================== - -log level: 9; error type: system error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: system error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: fatal user error; test case type: free function; - -=========================== - -log level: 9; error type: fatal user error; test case type: user test case; - -=========================== - -log level: 9; error type: fatal user error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: fatal user error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: fatal system error; test case type: free function; - -=========================== - -log level: 9; error type: fatal system error; test case type: user test case; - -=========================== - -log level: 9; error type: fatal system error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: fatal system error; test case type: parameterized user test case; - -Test case "call_test_main" passed with: -240 assertions out of 240 passed - 0 assertions out of 240 failed diff --git a/test/test_files/errors_handling_test.pattern2 b/test/test_files/errors_handling_test.pattern2 index ed2d4d20..e022c5b7 100755 --- a/test/test_files/errors_handling_test.pattern2 +++ b/test/test_files/errors_handling_test.pattern2 @@ -1,1140 +1,281 @@ =========================== +log level: log_successful_tests; error type: no error; -log level: 0; error type: no error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +92: info: check 'no error' passed +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user message; -log level: 0; error type: no error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +message +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user warning; -log level: 0; error type: no error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +100: warning in "error_on_demand": warning +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: user non-fatal error; -log level: 0; error type: no error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +104: error in "error_on_demand": non-fatal error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: cpp exception; -log level: 0; error type: user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_successful_tests; error type: system error; -log level: 0; error type: user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +108: fatal error in "error_on_demand": fatal error +198: info: check 'Test case has less failures then expected' passed +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: no error; -log level: 0; error type: user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user message; -log level: 0; error type: user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +message +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user warning; -log level: 0; error type: cpp exception; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +100: warning in "error_on_demand": warning +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: user non-fatal error; -log level: 0; error type: cpp exception; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +104: error in "error_on_demand": non-fatal error +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: cpp exception; -log level: 0; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error +Leaving test case "error_on_demand" =========================== +log level: log_test_suites; error type: system error; -log level: 0; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +Entering test case "error_on_demand" +108: fatal error in "error_on_demand": fatal error +Leaving test case "error_on_demand" =========================== +log level: log_messages; error type: no error; -log level: 0; error type: fatal user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_messages; error type: user message; -log level: 0; error type: fatal user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +message =========================== +log level: log_messages; error type: user warning; -log level: 0; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +100: warning in "error_on_demand": warning =========================== +log level: log_messages; error type: user non-fatal error; -log level: 0; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_messages; error type: cpp exception; -log level: 1; error type: no error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_messages; error type: system error; -log level: 1; error type: no error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_warnings; error type: no error; -log level: 1; error type: no error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" =========================== +log level: log_warnings; error type: user message; -log level: 1; error type: no error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -error_on_demand() BOOST_MESSAGE -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" =========================== +log level: log_warnings; error type: user warning; -log level: 1; error type: user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +100: warning in "error_on_demand": warning =========================== +log level: log_warnings; error type: user non-fatal error; -log level: 1; error type: user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_warnings; error type: cpp exception; -log level: 1; error type: user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_warnings; error type: system error; -log level: 1; error type: user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_all_errors; error type: no error; -log level: 1; error type: cpp exception; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user message; -log level: 1; error type: cpp exception; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user warning; -log level: 1; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" =========================== +log level: log_all_errors; error type: user non-fatal error; -log level: 1; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" +104: error in "error_on_demand": non-fatal error =========================== +log level: log_all_errors; error type: cpp exception; -log level: 1; error type: fatal user error; test case type: free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function" -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL -Leaving test case "bad_function" -Leaving test suite "Errors handling test" +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_all_errors; error type: system error; -log level: 1; error type: fatal user error; test case type: user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test" -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test" -Leaving test suite "Errors handling test" +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_cpp_exception_errors; error type: no error; -log level: 1; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_function_param" -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_function_param" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: user message; -log level: 1; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -Entering test suite "Errors handling test" -Entering test case "bad_test::test_param" -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL -Leaving test case "bad_test::test_param" -Leaving test suite "Errors handling test" =========================== +log level: log_cpp_exception_errors; error type: user warning; -log level: 2; error type: no error; test case type: free function; -Running 1 test case... -(free function) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_cpp_exception_errors; error type: user non-fatal error; -log level: 2; error type: no error; test case type: user test case; -Running 1 test case... -(user test case) -error_on_demand() BOOST_MESSAGE =========================== +log level: log_cpp_exception_errors; error type: cpp exception; -log level: 2; error type: no error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -error_on_demand() BOOST_MESSAGE +Exception in "error_on_demand": std::runtime_error: test std::runtime error what() message +114: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_cpp_exception_errors; error type: system error; -log level: 2; error type: no error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -error_on_demand() BOOST_MESSAGE +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_system_errors; error type: no error; -log level: 2; error type: user error; test case type: free function; -Running 1 test case... -(free function) -73: error in "bad_function": error_on_demand() BOOST_ERROR =========================== +log level: log_system_errors; error type: user message; -log level: 2; error type: user error; test case type: user test case; -Running 1 test case... -(user test case) -73: error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== +log level: log_system_errors; error type: user warning; -log level: 2; error type: user error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -73: error in "bad_function_param": error_on_demand() BOOST_ERROR =========================== +log level: log_system_errors; error type: user non-fatal error; -log level: 2; error type: user error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR =========================== +log level: log_system_errors; error type: cpp exception; -log level: 2; error type: cpp exception; test case type: free function; -Running 1 test case... -(free function) -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_system_errors; error type: system error; -log level: 2; error type: cpp exception; test case type: user test case; -Running 1 test case... -(user test case) -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_fatal_errors; error type: no error; -log level: 2; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: user message; -log level: 2; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error =========================== +log level: log_fatal_errors; error type: user warning; -log level: 2; error type: fatal user error; test case type: free function; -Running 1 test case... -(free function) -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL =========================== +log level: log_fatal_errors; error type: user non-fatal error; -log level: 2; error type: fatal user error; test case type: user test case; -Running 1 test case... -(user test case) -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL =========================== +log level: log_fatal_errors; error type: cpp exception; -log level: 2; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -(parameterized free function) -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL =========================== +log level: log_fatal_errors; error type: system error; -log level: 2; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -(parameterized user test case) -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL +108: fatal error in "error_on_demand": fatal error =========================== +log level: log_nothing; error type: no error; -log level: 3; error type: no error; test case type: free function; -Running 1 test case... =========================== +log level: log_nothing; error type: user message; -log level: 3; error type: no error; test case type: user test case; -Running 1 test case... =========================== +log level: log_nothing; error type: user warning; -log level: 3; error type: no error; test case type: parameterized free function; -Running 1 test case... =========================== +log level: log_nothing; error type: user non-fatal error; -log level: 3; error type: no error; test case type: parameterized user test case; -Running 1 test case... =========================== +log level: log_nothing; error type: cpp exception; -log level: 3; error type: user error; test case type: free function; -Running 1 test case... -73: error in "bad_function": error_on_demand() BOOST_ERROR =========================== +log level: log_nothing; error type: system error; -log level: 3; error type: user error; test case type: user test case; -Running 1 test case... -73: error in "bad_test::test": error_on_demand() BOOST_ERROR =========================== - -log level: 3; error type: user error; test case type: parameterized free function; -Running 1 test case... -73: error in "bad_function_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 3; error type: user error; test case type: parameterized user test case; -Running 1 test case... -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 3; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 3; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 3; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 4; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 4; error type: user error; test case type: free function; -Running 1 test case... -73: error in "bad_function": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: user test case; -Running 1 test case... -73: error in "bad_test::test": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: parameterized free function; -Running 1 test case... -73: error in "bad_function_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: user error; test case type: parameterized user test case; -Running 1 test case... -73: error in "bad_test::test_param": error_on_demand() BOOST_ERROR - -=========================== - -log level: 4; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 4; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 4; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 5; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 5; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 5; error type: cpp exception; test case type: free function; -Running 1 test case... -Exception in "bad_function": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: user test case; -Running 1 test case... -Exception in "bad_test::test": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... -Exception in "bad_function_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... -Exception in "bad_test::test_param": std::runtime_error: test std::runtime error what() message -84: last checkpoint: error_on_demand() throw runtime_error - -=========================== - -log level: 5; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 5; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: free function; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 6; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 6; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 6; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: no error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: free function; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -=========================== - -log level: 7; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -=========================== - -log level: 7; error type: fatal user error; test case type: free function; -Running 1 test case... -78: fatal error in "bad_function": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: user test case; -Running 1 test case... -78: fatal error in "bad_test::test": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... -78: fatal error in "bad_function_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 7; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... -78: fatal error in "bad_test::test_param": error_on_demand() BOOST_FAIL - -=========================== - -log level: 8; error type: no error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: no error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: user error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: cpp exception; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: parameterized free function; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 8; error type: fatal user error; test case type: parameterized user test case; -Running 1 test case... - -0% 10 20 30 40 50 60 70 80 90 100% -|----|----|----|----|----|----|----|----|----|----| -*************************************************** - -=========================== - -log level: 9; error type: no error; test case type: free function; - -=========================== - -log level: 9; error type: no error; test case type: user test case; - -=========================== - -log level: 9; error type: no error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: no error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: user error; test case type: free function; - -=========================== - -log level: 9; error type: user error; test case type: user test case; - -=========================== - -log level: 9; error type: user error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: user error; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: cpp exception; test case type: free function; - -=========================== - -log level: 9; error type: cpp exception; test case type: user test case; - -=========================== - -log level: 9; error type: cpp exception; test case type: parameterized free function; - -=========================== - -log level: 9; error type: cpp exception; test case type: parameterized user test case; - -=========================== - -log level: 9; error type: fatal user error; test case type: free function; - -=========================== - -log level: 9; error type: fatal user error; test case type: user test case; - -=========================== - -log level: 9; error type: fatal user error; test case type: parameterized free function; - -=========================== - -log level: 9; error type: fatal user error; test case type: parameterized user test case; - -Test case "call_test_main" passed with: -160 assertions out of 160 passed - 0 assertions out of 160 failed diff --git a/test/test_files/result_report_test.pattern b/test/test_files/result_report_test.pattern index ab6b3e09..424dc365 100644 --- a/test/test_files/result_report_test.pattern +++ b/test/test_files/result_report_test.pattern @@ -2,710 +2,189 @@ *** No errors detected ************************************************************************* +Test suite "0 test cases inside" passed -Test case "call_test_main" passed with: -1 assertion out of 1 passed -0 assertions out of 1 failed ************************************************************************* +Test suite "0 test cases inside" passed -Test case "call_test_main" passed with: -2 assertions out of 2 passed -0 assertions out of 2 failed ************************************************************************* - - - - - -************************************************************************* - - - - - - -************************************************************************* - - - - - - -************************************************************************* - +************************************************************************* +************************************************************************* +************************************************************************* *** No errors detected ************************************************************************* +Test suite "1 test cases inside" passed with: + 1 assertion out of 1 passed + 1 test case out of 1 passed -Test suite "call_test_main" passed with: -7 assertions out of 7 passed -0 assertions out of 7 failed ************************************************************************* +Test suite "1 test cases inside" passed with: + 1 assertion out of 1 passed + 1 test case out of 1 passed -Test suite "call_test_main" passed with: -8 assertions out of 8 passed -0 assertions out of 8 failed + Test case "good_foo" passed with: + 1 assertion out of 1 passed - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed ************************************************************************* - - - - - -************************************************************************* - - - - - - -************************************************************************* - - - - - - - - - -************************************************************************* - +************************************************************************* +************************************************************************* +************************************************************************* *** No errors detected ************************************************************************* +Test suite "1 bad test cases inside" passed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + 1 failure expected + 1 test case out of 1 passed -Test suite "call_test_main" passed with: -2 test cases out of 2 passed -0 test cases out of 2 failed -13 assertions out of 13 passed - 0 assertions out of 13 failed ************************************************************************* +Test suite "1 bad test cases inside" passed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + 1 failure expected + 1 test case out of 1 passed -Test suite "call_test_main" passed with: -2 test cases out of 2 passed -0 test cases out of 2 failed -14 assertions out of 14 passed - 0 assertions out of 14 failed + Test case "bad_foo" passed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + 1 failure expected - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed ************************************************************************* - - - - - -************************************************************************* - - - - - - - -************************************************************************* - - - - - - - - - - - - - - - - -************************************************************************* - +************************************************************************* +************************************************************************* +************************************************************************* *** No errors detected ************************************************************************* - -Test suite "call_test_main" passed with: -4 test cases out of 4 passed -0 test cases out of 4 failed -19 assertions out of 20 passed - 1 assertion out of 20 failed -while 1 failure expected -************************************************************************* - - -Test suite "call_test_main" passed with: -4 test cases out of 4 passed -0 test cases out of 4 failed -20 assertions out of 21 passed - 1 assertion out of 21 failed -while 1 failure expected - - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "2 test cases inside" passed with: +Test suite "2 test cases inside" passed with: + 2 assertions out of 3 passed + 1 assertion out of 3 failed + 1 failure expected 2 test cases out of 2 passed - 0 test cases out of 2 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected ************************************************************************* - - - - +Test suite "2 test cases inside" passed with: + 2 assertions out of 3 passed + 1 assertion out of 3 failed + 1 failure expected + 2 test cases out of 2 passed + + Test case "good_foo" passed with: + 1 assertion out of 1 passed + + Test case "bad_foo" passed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + 1 failure expected + +************************************************************************* +************************************************************************* +************************************************************************* +************************************************************************* + +*** 2 failures detected in test suite "3 test cases inside" ************************************************************************* - - - - - - +Test suite "3 test cases inside" failed with: + 2 assertions out of 4 passed + 2 assertions out of 4 failed + 2 test cases out of 3 failed + 1 test case out of 3 skipped + ************************************************************************* - - - - - - - - - - - - - - - - - - - - - - - - - +Test suite "3 test cases inside" failed with: + 2 assertions out of 4 passed + 2 assertions out of 4 failed + 2 test cases out of 3 failed + 1 test case out of 3 skipped + + Test case "bad_foo" failed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + + Test case "very_bad_foo" aborted with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + + Test case "bad_foo" skipped + +************************************************************************* +************************************************************************* +************************************************************************* +************************************************************************* + +*** 5 failures detected (1 failure expected) in test suite "Fake Test Suite Hierarchy" ************************************************************************* +Test suite "Fake Test Suite Hierarchy" failed with: + 11 assertions out of 16 passed + 5 assertions out of 16 failed + 1 failure expected + 5 test cases out of 11 passed + 3 test cases out of 11 failed + 3 test cases out of 11 skipped -*** No errors detected ************************************************************************* +Test suite "Fake Test Suite Hierarchy" failed with: + 11 assertions out of 16 passed + 5 assertions out of 16 failed + 1 failure expected + 5 test cases out of 11 passed + 3 test cases out of 11 failed + 3 test cases out of 11 skipped -Test suite "call_test_main" passed with: -5 test cases out of 5 passed -0 test cases out of 5 failed -25 assertions out of 27 passed - 2 assertions out of 27 failed -while 2 failures expected -************************************************************************* - - -Test suite "call_test_main" passed with: -5 test cases out of 5 passed -0 test cases out of 5 failed -26 assertions out of 28 passed - 2 assertions out of 28 failed -while 2 failures expected - - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed + Test suite "0 test cases inside" passed Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "2 test cases inside" passed with: - 2 test cases out of 2 passed - 0 test cases out of 2 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "1 bad test cases inside" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected -************************************************************************* - - - - - -************************************************************************* - - - - - - - -************************************************************************* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -************************************************************************* - - -*** No errors detected -************************************************************************* - - -Test suite "call_test_main" passed with: -8 test cases out of 8 passed -0 test cases out of 8 failed -31 assertions out of 34 passed - 3 assertions out of 34 failed -while 3 failures expected -************************************************************************* - - -Test suite "call_test_main" passed with: -8 test cases out of 8 passed -0 test cases out of 8 failed -32 assertions out of 35 passed - 3 assertions out of 35 failed -while 3 failures expected - - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "2 test cases inside" passed with: - 2 test cases out of 2 passed - 0 test cases out of 2 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "1 bad test cases inside" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "3 test cases inside" passed with: - 3 test cases out of 3 passed - 0 test cases out of 3 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected -************************************************************************* - - - - - -************************************************************************* - - - - - - - -************************************************************************* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -************************************************************************* - - -*** No errors detected -************************************************************************* - - -Test suite "call_test_main" passed with: -15 test cases out of 15 passed - 0 test cases out of 15 failed -37 assertions out of 42 passed - 5 assertions out of 42 failed -while 5 failures expected -************************************************************************* - - -Test suite "call_test_main" passed with: -15 test cases out of 15 passed - 0 test cases out of 15 failed -38 assertions out of 43 passed - 5 assertions out of 43 failed -while 5 failures expected - - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "2 test cases inside" passed with: - 2 test cases out of 2 passed - 0 test cases out of 2 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "1 bad test cases inside" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "3 test cases inside" passed with: - 3 test cases out of 3 passed - 0 test cases out of 3 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - - Test suite "Fake Test Suite Hierarchy" passed with: - 7 test cases out of 7 passed - 0 test cases out of 7 failed - 0 assertions out of 2 passed - 2 assertions out of 2 failed - while 2 failures expected - - Test case "0 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "1 test cases inside" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed - - Test suite "2 test cases inside" passed with: + 3 assertions out of 3 passed 2 test cases out of 2 passed - 0 test cases out of 2 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed + Test case "good_foo" passed with: + 2 assertions out of 2 passed - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected + Test suite "2 test cases inside" failed with: + 6 assertions out of 9 passed + 3 assertions out of 9 failed + 1 failure expected + 3 test cases out of 4 passed + 1 test case out of 4 failed - Test suite "3 test cases inside" passed with: - 3 test cases out of 3 passed - 0 test cases out of 3 failed - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected + Test case "good_foo" passed with: + 2 assertions out of 2 passed - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed + Test case "bad_foo" failed with: + 2 assertions out of 4 passed + 2 assertions out of 4 failed + 1 failure expected - Test case "good_foo" passed with: - 0 assertions out of 0 passed - 0 assertions out of 0 failed + Test suite "3 test cases inside" failed with: + 2 assertions out of 4 passed + 2 assertions out of 4 failed + 2 test cases out of 5 failed + 3 test cases out of 5 skipped + + Test case "bad_foo" failed with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + + Test case "very_bad_foo" aborted with: + 1 assertion out of 2 passed + 1 assertion out of 2 failed + + Test case "bad_foo" skipped - Test case "bad_foo" passed with: - 0 assertions out of 1 passed - 1 assertion out of 1 failed - while 1 failure expected ************************************************************************* - - - - - -************************************************************************* - - - - - - - -************************************************************************* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -************************************************************************* - +************************************************************************* +************************************************************************* +************************************************************************* diff --git a/test/test_files/test_fp_comparisons.pattern b/test/test_files/test_fp_comparisons.pattern new file mode 100644 index 00000000..5afafeeb --- /dev/null +++ b/test/test_files/test_fp_comparisons.pattern @@ -0,0 +1,29 @@ +117: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-020} exceeds 1e-005% +118: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-030} exceeds 1e-005% +119: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-010} exceeds 0.1% +120: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001% +124: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001% +128: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-010} and fp2{1.23457e-011} exceeds 0.001% +129: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-010} and fp2{1.112e-010} exceeds 0.08999% +130: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-010} and fp2{1.111e-010} exceeds 0.08999% +135: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011% +117: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-020} exceeds 1e-005% +118: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-030} exceeds 1e-005% +119: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-010} exceeds 0.1% +120: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001% +124: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001% +128: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-010} and fp2{1.23457e-011} exceeds 0.001% +129: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-010} and fp2{1.112e-010} exceeds 0.08999% +130: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-010} and fp2{1.111e-010} exceeds 0.08999% +135: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011% +117: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-020} exceeds 1e-005% +118: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{1e-030} exceeds 1e-005% +119: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0} and fp2{-1e-010} exceeds 0.1% +120: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{0.123457} exceeds 0.0001% +124: error in "test_BOOST_CHECK_CLOSE": difference between fp1{0.123456} and fp2{-0.123457} exceeds 0.001% +128: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.23456e-010} and fp2{1.23457e-011} exceeds 0.001% +129: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.111e-010} and fp2{1.112e-010} exceeds 0.08999% +130: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1.112e-010} and fp2{1.111e-010} exceeds 0.08999% +135: error in "test_BOOST_CHECK_CLOSE": difference between fp1{1} and fp2{1.0002} exceeds 0.011% +175: error in "test_close_at_tolerance": difference between fp1{1} and fp2{1} exceeds 1e-006% +182: error in "test_close_at_tolerance": check close_at_tolerance( epsilon )( fp1, fp2 ) failed for ( 1.23456e-010, 1.23457e-010 ) diff --git a/test/test_files/test_tools_test.pattern b/test/test_files/test_tools_test.pattern new file mode 100644 index 00000000..7edf9f92 --- /dev/null +++ b/test/test_files/test_tools_test.pattern @@ -0,0 +1,61 @@ +128: warning in "test_BOOST_WARN": condition sizeof(int) == sizeof(short) is not satisfied +131: info: check sizeof(unsigned char) == sizeof(char) passed +145: error in "test_BOOST_CHECK": check false failed +146: error in "test_BOOST_CHECK": check 1==2 failed +147: error in "test_BOOST_CHECK": check i==1 failed +150: info: check i==2 passed +157: error in "test_BOOST_REQUIRE": not aborted +159: fatal error in "test_BOOST_REQUIRE": critical test false failed +163: fatal error in "test_BOOST_REQUIRE": critical test j > 5 failed +166: info: check j < 5 passed +166: error in "test_BOOST_REQUIRE": not aborted +180: info: check 'object size 33 is too small' passed +197: error in "test_BOOST_CHECK_MESSAGE": Well, may be that what I belive in +199: error in "test_BOOST_CHECK_MESSAGE": Checking predicate failed. Some explanation +202: info: check 'Could it fail?' passed +209: fatal error in "test_BOOST_REQUIRE_MESSAGE": Here we should stop +212: info: check 'That's OK' passed +212: error in "test_BOOST_REQUIRE_MESSAGE": not aborted +219: error in "test_BOOST_ERROR": Fail to miss an error +226: fatal error in "test_BOOST_FAIL": No! No! Show must go on. +242: error in "test_BOOST_CHECK_THROW": exception my_exception is expected +245: warning in "test_BOOST_CHECK_THROW": exception my_exception is expected +248: fatal error in "test_BOOST_CHECK_THROW": exception my_exception is expected +251: info: check 'exception my_exception is caught' passed +258: error in "test_BOOST_CHECK_EXCEPTION": incorrect exception my_exception is caught +261: info: check 'incorrect exception my_exception is caught' passed +271: error in "test_BOOST_CHECK_NO_THROW": exception thrown by throw my_exception() +317: error in "test_BOOST_CHECK_EQUAL": check i == j failed [1 != 2] +321: error in "test_BOOST_CHECK_EQUAL": check str1 == str2 failed [test1 != test12] +324: info: check i+1 == j passed +327: info: check str1 == str3+1 passed +336: fatal error in "test_BOOST_CHECK_EQUAL": critical test str1 == str2 failed [test != null string] +342: warning in "test_BOOST_CHECK_EQUAL": condition b1 == b2 is not satisfied [B(1) != B(2)] +348: error in "test_BOOST_CHECK_EQUAL": check c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch +349: error in "test_BOOST_CHECK_EQUAL": check c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch +379: error in "test_BOOST_CHECK_PREDICATE": check is_even( i ) failed for ( 17 ) +382: error in "test_BOOST_CHECK_PREDICATE": check not_equal_to()( i, 17 ) failed for ( 17, 17 ) +388: warning in "test_BOOST_CHECK_PREDICATE": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 ) +396: error in "test_BOOST_CHECK_PREDICATE": check compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0] +407: error in "test_BOOST_REQUIRE_PREDICATE": not aborted +409: fatal error in "test_BOOST_REQUIRE_PREDICATE": critical test less_equal()( arg2, arg1 ) failed for ( 2, 1 ) +430: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed. +Mismatch in a position 2: 4 != 3 +Mismatch in a position 5: 7 != 6 +431: error in "test_BOOST_CHECK_EQUAL_COLLECTIONS": check { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed. +Collections size mismatch: 7 != 2 +440: error in "test_BOOST_CHECK_BITWISE_EQUAL": check (char)0x06 =.= (char)0x16 failed. +Mismatch in a position 4 +443: warning in "test_BOOST_CHECK_BITWISE_EQUAL": condition (char)0x26 =.= (char)0x04 is not satisfied. +Mismatch in a position 1 +Mismatch in a position 5 +446: fatal error in "test_BOOST_CHECK_BITWISE_EQUAL": critical test (char)0x26 =.= (int)0x26 failed. +Operands bit sizes mismatch: 8 != 32 +still testing +1+1=2 +2+2=4 +struct A +0x14 + 20 +Exception in "test_BOOST_CHECKPOINT": C string: some error +479: last checkpoint: Going to do a silly things diff --git a/test/test_fp_comparisons.cpp b/test/test_fp_comparisons.cpp index 5b0dd78b..3fddc12b 100644 --- a/test/test_fp_comparisons.cpp +++ b/test/test_fp_comparisons.cpp @@ -1,6 +1,6 @@ // (C) Copyright Gennadiy Rozental 2001-2004. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -14,198 +14,183 @@ // Boost.Test #include -#include -#include +#define BOOST_AUTO_TEST_MAIN +#include #include +#include +#include #include #include +#include using namespace boost::unit_test; using namespace boost::test_tools; -// Boost -#include - // STL #include +// Boost +#include + //____________________________________________________________________________// -#define CHECK_TOOL_USAGE( tool_usage, check ) \ -{ \ - boost::test_tools::output_test_stream output; \ +struct shorten_lf : public boost::unit_test::output::compiler_log_formatter +{ + void print_prefix( std::ostream& output, boost::unit_test::const_string, std::size_t line ) + { + output << line << ": "; + } +}; + +//____________________________________________________________________________// + +std::string match_file_name( "./test_files/test_fp_comparisons.pattern" ); +std::string save_file_name( "test_fp_comparisons.pattern" ); + +output_test_stream& ots() +{ + static boost::shared_ptr inst; + + if( !inst ) { + inst.reset( new output_test_stream( + runtime_config::save_pattern() ? save_file_name : match_file_name, + !runtime_config::save_pattern() ) + ); + } + + return *inst; +} + +//____________________________________________________________________________// + +#define TEST_CASE( name ) \ +void name ## _impl(); \ +void name ## _impl_defer(); \ \ - unit_test_log.set_stream( output ); \ - { unit_test_result_saver saver; \ - tool_usage; \ - } \ - unit_test_log.set_stream( std::cout ); \ - BOOST_CHECK( check ); \ -} +BOOST_AUTO_TEST_CASE( name ) \ +{ \ + test_case* impl = make_test_case( &name ## _impl, #name ); \ + \ + unit_test_log.set_stream( ots() ); \ + unit_test_log.set_threshold_level( log_nothing ); \ + unit_test_log.set_formatter( new shorten_lf ); \ + framework::run( impl ); \ + \ + unit_test_log.set_threshold_level( \ + runtime_config::log_level() != invalid_log_level \ + ? runtime_config::log_level() \ + : log_all_errors ); \ + unit_test_log.set_format( runtime_config::log_format());\ + unit_test_log.set_stream( std::cout ); \ + BOOST_CHECK( ots().match_pattern() ); \ +} \ + \ +void name ## _impl() \ +{ \ + unit_test_log.set_threshold_level( log_all_errors ); \ + \ + name ## _impl_defer(); \ + \ + unit_test_log.set_threshold_level( log_nothing ); \ +} \ + \ +void name ## _impl_defer() \ +/**/ //____________________________________________________________________________// -char -set_unix_slash( char in ) -{ - return in == '\\' ? '/' : in; -} - -static std::string const& -normalize_file_name( char const* f ) -{ - static std::string buffer; - - buffer = f; - - std::transform( buffer.begin(), buffer.end(), buffer.begin(), &set_unix_slash ); - - return buffer; -} - -#ifdef BOOST_TEST_SHIFTED_LINE - -#define CHECK_PATTERN( msg, shift ) \ - (boost::wrap_stringstream().ref() << normalize_file_name( __FILE__ ) << "(" << (__LINE__-shift) << "): " << msg).str() - -#else - -#define CHECK_PATTERN( msg, shift ) \ - (boost::wrap_stringstream().ref() << normalize_file_name( __FILE__ ) << "(" << __LINE__ << "): " << msg).str() - -#endif -//____________________________________________________________________________// - template -void -test_BOOST_CHECK_CLOSE( FPT = FPT() ) -{ -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << '\"' << "test_BOOST_CHECK_CLOSE" << "\"" << - unit_test_log.set_threshold_level( log_messages ); - - BOOST_MESSAGE( "testing BOOST_CHECK_CLOSE for " << typeid(FPT).name() ); - - -#define BOOST_CHECK_CLOSE_SHOULD_PASS( first, second, e ) \ - fp1 = static_cast(first); \ - fp2 = static_cast(second); \ - epsilon = static_cast(e); \ - \ - CHECK_TOOL_USAGE( \ - BOOST_CHECK_CLOSE( fp1, fp2, epsilon ), \ - output.is_empty() \ - ) \ +struct test_BOOST_CHECK_CLOSE_body { + void operator()() { +#define DO_BOOST_CHECK_CLOSE( first, second, e ) \ + fp1 = static_cast(first); \ + fp2 = static_cast(second); \ + epsilon = static_cast(e); \ + \ + BOOST_CHECK_CLOSE( fp1, fp2, epsilon ); \ /**/ + unit_test_log.set_threshold_level( log_all_errors ); -#define BOOST_CHECK_CLOSE_SHOULD_FAIL( first, second, e ) \ - fp1 = static_cast(first); \ - fp2 = static_cast(second); \ - epsilon = static_cast(e); \ - \ - CHECK_TOOL_USAGE( \ - BOOST_CHECK_CLOSE( fp1, fp2, epsilon ), \ - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": difference between fp1{" << \ - fp1 << "} and fp2{" << fp2 << "} exceeds " << epsilon << "%\n", 0 ) ) \ - ) \ -/**/ - FPT fp1, fp2, epsilon; + FPT fp1, fp2, epsilon; - BOOST_CHECK_CLOSE_SHOULD_PASS( 1, 1, 0 ); + DO_BOOST_CHECK_CLOSE( 1, 1, 0 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 0, 1e-20, 1e-5 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 0, 1e-30, 1e-5 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 0, -1e-10, 0.1 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 0.123456, 0.123457, 1e-4 ); + DO_BOOST_CHECK_CLOSE( 0, 1e-20, 1e-5 ); + DO_BOOST_CHECK_CLOSE( 0, 1e-30, 1e-5 ); + DO_BOOST_CHECK_CLOSE( 0, -1e-10, 0.1 ); + DO_BOOST_CHECK_CLOSE( 0.123456, 0.123457, 1e-4 ); - BOOST_CHECK_CLOSE_SHOULD_PASS( 0.123456, 0.123457, 1e-3 ); + DO_BOOST_CHECK_CLOSE( 0.123456, 0.123457, 1e-3 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 0.123456, -0.123457, 1e-3 ); + DO_BOOST_CHECK_CLOSE( 0.123456, -0.123457, 1e-3 ); - BOOST_CHECK_CLOSE_SHOULD_PASS( 1.23456e28, 1.23457e28, 1e-3 ); + DO_BOOST_CHECK_CLOSE( 1.23456e28, 1.23457e28, 1e-3 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 1.23456e-10, 1.23457e-11, 1e-3 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 1.111e-10, 1.112e-10, 0.08999 ); - BOOST_CHECK_CLOSE_SHOULD_FAIL( 1.112e-10, 1.111e-10, 0.08999 ); + DO_BOOST_CHECK_CLOSE( 1.23456e-10, 1.23457e-11, 1e-3 ); + DO_BOOST_CHECK_CLOSE( 1.111e-10, 1.112e-10, 0.08999 ); + DO_BOOST_CHECK_CLOSE( 1.112e-10, 1.111e-10, 0.08999 ); - BOOST_CHECK_CLOSE_SHOULD_PASS( 1 , 1.0001, 1.1e-2 ); - BOOST_CHECK_CLOSE_SHOULD_PASS( 1.0002, 1.0001, 1.1e-2 ); - - BOOST_CHECK_CLOSE_SHOULD_FAIL( 1 , 1.0002, 1.1e-2 ); -} + DO_BOOST_CHECK_CLOSE( 1 , 1.0001, 1.1e-2 ); + DO_BOOST_CHECK_CLOSE( 1.0002, 1.0001, 1.1e-2 ); -BOOST_META_FUNC_TEST_CASE( test_BOOST_CHECK_CLOSE ); + DO_BOOST_CHECK_CLOSE( 1 , 1.0002, 1.1e-2 ); + + unit_test_log.set_threshold_level( log_nothing ); + } +}; //____________________________________________________________________________// -void -test_close_at_tolerance() -{ -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << '\"' << "test_close_at_tolerance" << "\"" << +typedef boost::mpl::list test_types; +BOOST_AUTO_TEST_CASE_TEMPLATE( test_BOOST_CHECK_CLOSE, FPT, test_types ) +{ + test_case* impl = make_test_case( test_BOOST_CHECK_CLOSE_body(), "test_BOOST_CHECK_CLOSE" ); + + unit_test_log.set_stream( ots() ); + unit_test_log.set_threshold_level( log_nothing ); + unit_test_log.set_formatter( new shorten_lf ); + + framework::run( impl ); + + unit_test_log.set_threshold_level( + runtime_config::log_level() != invalid_log_level + ? runtime_config::log_level() + : log_all_errors ); + unit_test_log.set_format( runtime_config::log_format()); + unit_test_log.set_stream( std::cout ); + BOOST_CHECK( ots().match_pattern() ); +} + +//____________________________________________________________________________// + +TEST_CASE( test_close_at_tolerance ) +{ double fp1 = 1.00000001; double fp2 = 1.00000002; double epsilon = 1e-6; close_at_tolerance pred( epsilon, FPC_WEAK ); - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( pred, (fp1)(fp2) ), - output.is_empty() - ); + BOOST_CHECK_PREDICATE( pred, (fp1)(fp2) ); - CHECK_TOOL_USAGE( - BOOST_CHECK_CLOSE( fp1, fp2, epsilon ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": difference between fp1{" << - fp1 << "} and fp2{" << fp2 << "} exceeds " << epsilon << "%\n", 3 ) ) - ); + BOOST_CHECK_CLOSE( fp1, fp2, epsilon ); fp1 = 1.23456e-10; fp2 = 1.23457e-10; epsilon = 8.1e-4; - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( close_at_tolerance( epsilon, FPC_WEAK ), (fp1)(fp2) ), - output.is_empty() - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( close_at_tolerance( epsilon ), (fp1)(fp2) ), - output.is_equal( CHECK_PATTERN( - "error in " TEST_CASE_NAME ": test close_at_tolerance( epsilon )( fp1, fp2 ) " - "failed for ( " << fp1 << ", " << fp2 << " )\n", 4 ) ) - ); -} - -//____________________________________________________________________________// - -test_suite* -init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) { - test_suite* test = BOOST_TEST_SUITE("FP compare test"); - - typedef boost::mpl::list FPTs; - - test->add( BOOST_FUNC_TEMPLATE_TEST_CASE( test_BOOST_CHECK_CLOSE, FPTs ) ); - test->add( BOOST_TEST_CASE( &test_close_at_tolerance ) ); - - return test; + BOOST_CHECK_PREDICATE( close_at_tolerance( epsilon, FPC_WEAK ), (fp1)(fp2) ); + BOOST_CHECK_PREDICATE( close_at_tolerance( epsilon ), (fp1)(fp2) ); } //____________________________________________________________________________// // *************************************************************************** // Revision History : -// -// $Log$ -// Revision 1.16 2005/01/30 03:35:55 rogeeff -// no message // -// Revision 1.14 2005/01/18 08:30:09 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls +// $Log$ +// Revision 1.17 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates +// // *************************************************************************** // EOF diff --git a/test/test_tools_test.cpp b/test/test_tools_test.cpp index 0a8ca0bf..3bfe3422 100644 --- a/test/test_tools_test.cpp +++ b/test/test_tools_test.cpp @@ -1,6 +1,6 @@ // (C) Copyright Gennadiy Rozental 2001-2004. // Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/libs/test for the library home page. @@ -15,89 +15,36 @@ // Boost.Test #define BOOST_AUTO_TEST_MAIN #include -#include #include #include +#include +#include +#include +#include using namespace boost::unit_test; +using namespace boost::test_tools; -// BOOST +// Boost #include // STL #include #include -#include -#include -#include //____________________________________________________________________________// -#define CHECK_TOOL_USAGE( tool_usage, check ) \ -{ \ - boost::test_tools::output_test_stream output; \ - \ - unit_test_log.set_stream( output ); \ - { unit_test_result_saver saver; \ - tool_usage; \ - } \ - unit_test_log.set_stream( std::cout ); \ - BOOST_CHECK((check)); \ -} - -//____________________________________________________________________________// - -#define CHECK_CRITICAL_TOOL_USAGE( tool_usage, nothrow_check, throw_check ) \ -{ \ - boost::test_tools::output_test_stream output; \ - \ - unit_test_log.set_stream( output ); \ - try { \ - { unit_test_result_saver saver; \ - tool_usage; \ - } \ - unit_test_log.set_stream( std::cout ); \ - BOOST_CHECK( nothrow_check ); \ - } catch( boost::test_tools::tt_detail::test_tool_failed const&) { \ - unit_test_log.set_stream( std::cout ); \ - BOOST_CHECK( throw_check ); \ - } \ -} - -//____________________________________________________________________________// - -static char qu = '"'; - -char -set_unix_slash( char in ) -{ - return in == '\\' ? '/' : in; -} - -static std::string const& -normalize_file_name( char const* f ) -{ - static std::string buffer; - - buffer = f; - - std::transform( buffer.begin(), buffer.end(), buffer.begin(), &set_unix_slash ); - - return buffer; -} - -//____________________________________________________________________________// - -#ifdef BOOST_TEST_SHIFTED_LINE - -#define CHECK_PATTERN( msg, shift ) \ - (boost::wrap_stringstream().ref() << normalize_file_name( __FILE__ ) << "(" << (__LINE__-shift) << "): " << msg).str() - -#else - -#define CHECK_PATTERN( msg, shift ) \ - (boost::wrap_stringstream().ref() << normalize_file_name( __FILE__ ) << "(" << __LINE__ << "): " << msg).str() - -#endif +#define CHECK_CRITICAL_TOOL_USAGE( tool_usage ) \ +{ \ + bool throw_ = false; \ + try { \ + tool_usage; \ + } catch( boost::execution_aborted const& ) { \ + throw_ = true; \ + } \ + \ + BOOST_CHECK_MESSAGE( throw_, "not aborted" ); \ +} \ +/**/ //____________________________________________________________________________// @@ -110,137 +57,127 @@ public: //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_WARN ) +struct shorten_lf : public boost::unit_test::output::compiler_log_formatter { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_WARN" << qu << + void print_prefix( std::ostream& output, boost::unit_test::const_string, std::size_t line ) + { + output << line << ": "; + } +}; - unit_test_log.set_threshold_level( log_warnings ); +//____________________________________________________________________________// - boost::wrap_stringstream ptrn; - ptrn << normalize_file_name( __FILE__ ) << "(" << (__LINE__+3) << "): " - << "warning in " TEST_CASE_NAME ": condition sizeof(int) == sizeof(short) is not satisfied\n"; +std::string match_file_name( "./test_files/test_tools_test.pattern" ); +std::string save_file_name( "test_tools_test.pattern" ); - CHECK_TOOL_USAGE( BOOST_WARN( sizeof(int) == sizeof(short) ), output.is_equal( ptrn.str() ) ); +output_test_stream& ots() +{ + static boost::shared_ptr inst; - unit_test_log.set_threshold_level( log_successful_tests ); + if( !inst ) { + inst.reset( new output_test_stream( + runtime_config::save_pattern() ? save_file_name : match_file_name, + !runtime_config::save_pattern() ) + ); + } - CHECK_TOOL_USAGE( - BOOST_WARN( sizeof(unsigned char) == sizeof(char) ), - output.is_equal( CHECK_PATTERN( "info: test sizeof(unsigned char) == sizeof(char) passed\n", 2 ) ) - ); - - unit_test_log.set_threshold_level( log_all_errors ); + return *inst; } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK ) +#define TEST_CASE( name ) \ +void name ## _impl(); \ +void name ## _impl_defer(); \ + \ +BOOST_AUTO_TEST_CASE( name ) \ +{ \ + test_case* impl = make_test_case( &name ## _impl, #name ); \ + \ + unit_test_log.set_stream( ots() ); \ + unit_test_log.set_threshold_level( log_nothing ); \ + unit_test_log.set_formatter( new shorten_lf ); \ + framework::run( impl ); \ + \ + unit_test_log.set_threshold_level( \ + runtime_config::log_level() != invalid_log_level \ + ? runtime_config::log_level() \ + : log_all_errors ); \ + unit_test_log.set_format( runtime_config::log_format());\ + unit_test_log.set_stream( std::cout ); \ + BOOST_CHECK( ots().match_pattern() ); \ +} \ + \ +void name ## _impl() \ +{ \ + unit_test_log.set_threshold_level( log_all_errors ); \ + \ + name ## _impl_defer(); \ + \ + unit_test_log.set_threshold_level( log_nothing ); \ +} \ + \ +void name ## _impl_defer() \ +/**/ + +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_WARN ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK" << qu << + unit_test_log.set_threshold_level( log_warnings ); + BOOST_WARN( sizeof(int) == sizeof(short) ); - unit_test_log.set_threshold_level( log_all_errors ); + unit_test_log.set_threshold_level( log_successful_tests ); + BOOST_WARN( sizeof(unsigned char) == sizeof(char) ); +} - CHECK_TOOL_USAGE( - BOOST_CHECK( true ), - output.is_empty() - ); +//____________________________________________________________________________// + +TEST_CASE( test_BOOST_CHECK ) +{ + BOOST_CHECK( true ); bool_convertible bc; - - CHECK_TOOL_USAGE( - BOOST_CHECK( bc ), - output.is_empty() - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK( false ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test false failed\n", 2 ) ) - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK( 1==2 ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test 1==2 failed\n", 2 ) ) - ); + BOOST_CHECK( bc ); int i=2; - CHECK_TOOL_USAGE( - BOOST_CHECK( i==1 ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test i==1 failed\n", 2 ) ) - ); + BOOST_CHECK( false ); + BOOST_CHECK( 1==2 ); + BOOST_CHECK( i==1 ); unit_test_log.set_threshold_level( log_successful_tests ); - CHECK_TOOL_USAGE( - BOOST_CHECK( i==2 ), - output.is_equal( CHECK_PATTERN( "info: test i==2 passed\n", 2 ) ) - ); - unit_test_log.set_threshold_level( log_all_errors ); + BOOST_CHECK( i==2 ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_REQUIRE ) +TEST_CASE( test_BOOST_REQUIRE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_REQUIRE" << qu << + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( true ) ); - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE( true ), - true, false - ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE( false ), - false, true - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( false ) ); int j = 3; - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE( j > 5 ), - false, output.is_equal( CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": critical test j > 5 failed\n", 2 ) ) - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( j > 5 ) ); unit_test_log.set_threshold_level( log_successful_tests ); - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE( j < 5 ), - output.is_equal( CHECK_PATTERN( "info: test j < 5 passed\n", 1 ) ) , false - ); - unit_test_log.set_threshold_level( log_all_errors ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE( j < 5 ) ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_WARN_MESSAGE ) +TEST_CASE( test_BOOST_WARN_MESSAGE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_WARN_MESSAGE" << qu << - - unit_test_log.set_threshold_level( log_warnings ); - - CHECK_TOOL_USAGE( - BOOST_WARN_MESSAGE( sizeof(int) == sizeof(short), "memory won't be used efficiently" ), - output.is_equal( CHECK_PATTERN( "warning in " TEST_CASE_NAME ": memory won't be used efficiently\n", 2 ) ) - ); - + BOOST_WARN_MESSAGE( sizeof(int) == sizeof(short), "memory won't be used efficiently" ); int obj_size = 33; - CHECK_TOOL_USAGE( - BOOST_WARN_MESSAGE( obj_size <= 8, "object size " << obj_size << " is too big to be efficiently passed by value" ), - output.is_equal( CHECK_PATTERN( "warning in " TEST_CASE_NAME - ": object size 33 is too big to be efficiently passed by value\n", 3 ) ) - ); + BOOST_WARN_MESSAGE( obj_size <= 8, + "object size " << obj_size << " is too big to be efficiently passed by value" ); unit_test_log.set_threshold_level( log_successful_tests ); - CHECK_TOOL_USAGE( - BOOST_WARN_MESSAGE( obj_size > 8, "object size " << obj_size << " is too small" ), - output.is_equal( CHECK_PATTERN( "info: object size 33 is too small\n", 2 ) ) - ); - unit_test_log.set_threshold_level( log_all_errors ); + BOOST_WARN_MESSAGE( obj_size > 8, "object size " << obj_size << " is too small" ); } //____________________________________________________________________________// @@ -255,173 +192,83 @@ test_pred1() return res; } -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_MESSAGE ) +TEST_CASE( test_BOOST_CHECK_MESSAGE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_MESSAGE" << qu << + BOOST_CHECK_MESSAGE( 2+2 == 5, "Well, may be that what I belive in" ); - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_MESSAGE( 2+2 == 5, "Well, may be that what I belive in" ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": Well, may be that what I belive in\n", 2 ) ) - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_MESSAGE( test_pred1(), "Checking predicate failed" ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": Checking predicate failed. Some explanation\n", 2 ) ) - ); + BOOST_CHECK_MESSAGE( test_pred1(), "Checking predicate failed" ); unit_test_log.set_threshold_level( log_successful_tests ); - CHECK_TOOL_USAGE( - BOOST_CHECK_MESSAGE( 2+2 == 4, "Could it fail?" ), - output.is_equal( CHECK_PATTERN( "info: Could it fail?\n", 2 ) ) - ); - unit_test_log.set_threshold_level( log_all_errors ); + BOOST_CHECK_MESSAGE( 2+2 == 4, "Could it fail?" ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_REQUIRE_MESSAGE ) +TEST_CASE( test_BOOST_REQUIRE_MESSAGE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_REQUIRE_MESSAGE" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_MESSAGE( false, "Here we should stop" ), - false, output.is_equal( - CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": Here we should stop" << "\n", 3 ) ) - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_MESSAGE( false, "Here we should stop" ) ); unit_test_log.set_threshold_level( log_successful_tests ); - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_MESSAGE( true, "That's OK" ), - output.is_equal( CHECK_PATTERN( "info: That's OK\n", 1 ) ), - false - ); - unit_test_log.set_threshold_level( log_all_errors ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_MESSAGE( true, "That's OK" ) ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_ERROR ) +TEST_CASE( test_BOOST_ERROR ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_ERROR" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_TOOL_USAGE( - BOOST_ERROR( "Fail to miss an error" ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": Fail to miss an error\n", 2 ) ) - ); + BOOST_ERROR( "Fail to miss an error" ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_FAIL ) +TEST_CASE( test_BOOST_FAIL ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_FAIL" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_FAIL( "No! No! Show must go on." ), - false, output.is_equal( CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": No! No! Show must go on.\n", 2 ) ) - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_FAIL( "No! No! Show must go on." ) ); } //____________________________________________________________________________// struct my_exception { explicit my_exception( int ec = 0 ) : m_error_code( ec ) {} - + int m_error_code; }; bool is_critical( my_exception const& ex ) { return ex.m_error_code < 0; } -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_THROW ) +TEST_CASE( test_BOOST_CHECK_THROW ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_THROW" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - int i=0; - CHECK_TOOL_USAGE( - BOOST_CHECK_THROW( i++, my_exception ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": exception my_exception is expected\n", 2 ) ) - ); + BOOST_CHECK_THROW( i++, my_exception ); unit_test_log.set_threshold_level( log_warnings ); - - CHECK_TOOL_USAGE( - BOOST_WARN_THROW( i++, my_exception ), - output.is_equal( CHECK_PATTERN( "warning in " TEST_CASE_NAME ": exception my_exception is expected\n", 2 ) ) - ); + BOOST_WARN_THROW( i++, my_exception ); unit_test_log.set_threshold_level( log_all_errors ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_THROW( i++, my_exception ) ); - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_THROW( i++, my_exception ), - false, - output.is_equal( CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": exception my_exception is expected\n", 3 ) ) - ); unit_test_log.set_threshold_level( log_successful_tests ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_THROW( throw my_exception(), my_exception ), - output.is_equal( CHECK_PATTERN( "info: exception my_exception is caught\n", 2 ) ) - ); - - unit_test_log.set_threshold_level( log_all_errors ); + BOOST_CHECK_THROW( throw my_exception(), my_exception ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_EXCEPTION ) +TEST_CASE( test_BOOST_CHECK_EXCEPTION ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_EXCEPTION" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_EXCEPTION( throw my_exception( 1 ), my_exception, is_critical ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": incorrect exception my_exception is caught\n", 2 ) ) - ); + BOOST_CHECK_EXCEPTION( throw my_exception( 1 ), my_exception, is_critical ); unit_test_log.set_threshold_level( log_successful_tests ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_EXCEPTION( throw my_exception( -1 ), my_exception, is_critical ), - output.is_equal( CHECK_PATTERN( "info: incorrect exception my_exception is caught\n", 2 ) ) - ); - - unit_test_log.set_threshold_level( log_all_errors ); + BOOST_CHECK_EXCEPTION( throw my_exception( -1 ), my_exception, is_critical ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_NO_THROW ) +TEST_CASE( test_BOOST_CHECK_NO_THROW ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_NO_THROW" << qu << - int i=0; - CHECK_TOOL_USAGE( - BOOST_CHECK_NO_THROW( i++ ), - output.is_empty() - ); + BOOST_CHECK_NO_THROW( i++ ); - CHECK_TOOL_USAGE( - BOOST_CHECK_NO_THROW( throw my_exception() ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": exception thrown by throw my_exception()\n", 2 ) ) - ); + BOOST_CHECK_NO_THROW( throw my_exception() ); } //____________________________________________________________________________// @@ -463,87 +310,43 @@ std::ostream& operator<<( std::ostream& str, C const& c ) { return str << "C(" < //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_EQUAL ) +TEST_CASE( test_BOOST_CHECK_EQUAL ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_EQUAL" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - int i=1; int j=2; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( i, j ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test i == j failed [1 != 2]\n", 2 ) ) - ); + BOOST_CHECK_EQUAL( i, j ); char const* str1 = "test1"; char const* str2 = "test12"; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( str1, str2 ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test str1 == str2 failed [test1 != test12]\n", 2 ) ) - ); + BOOST_CHECK_EQUAL( str1, str2 ); unit_test_log.set_threshold_level( log_successful_tests ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( i+1, j ), - output.is_equal( CHECK_PATTERN( "info: test i+1 == j passed\n", 2 ) ) - ); + BOOST_CHECK_EQUAL( i+1, j ); char const* str3 = "1test1"; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( str1, str3+1 ), - output.is_equal( CHECK_PATTERN( "info: test str1 == str3+1 passed\n", 2 ) ) - ); + BOOST_CHECK_EQUAL( str1, str3+1 ); unit_test_log.set_threshold_level( log_all_errors ); - str1 = NULL; str2 = NULL; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( str1, str2 ), - output.is_empty() - ); + BOOST_CHECK_EQUAL( str1, str2 ); str1 = "test"; str2 = NULL; - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_EQUAL( str1, str2 ), - false, - output.is_equal( CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": critical test str1 == str2 failed [test != null string]\n", 3 ) ) - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_EQUAL( str1, str2 ) ); B b1(1); B b2(2); unit_test_log.set_threshold_level( log_warnings ); - - CHECK_TOOL_USAGE( - BOOST_WARN_EQUAL( b1, b2 ), - output.is_equal( CHECK_PATTERN( "warning in " TEST_CASE_NAME ": condition b1 == b2 is not satisfied [B(1) != B(2)]\n", 2 ) ) - ); + BOOST_WARN_EQUAL( b1, b2 ); unit_test_log.set_threshold_level( log_all_errors ); - C c1( 0, 100 ); C c2( 0, 101 ); C c3( 1, 102 ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( c1, c3 ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test c1 == c3 failed [C(0,100) != C(1,102)]. Index mismatch\n", 2 ) ) - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL( c1, c2 ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test c1 == c2 failed [C(0,100) != C(0,101)]. Id mismatch\n", 2 ) ) - ); + BOOST_CHECK_EQUAL( c1, c3 ); + BOOST_CHECK_EQUAL( c1, c2 ); } //____________________________________________________________________________// @@ -568,91 +371,48 @@ compare_lists( std::list const& l1, std::list const& l2 ) return true; } -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_PREDICATE ) +TEST_CASE( test_BOOST_CHECK_PREDICATE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_PREDICATE" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( is_even, (14) ), - output.is_empty() - ); + BOOST_CHECK_PREDICATE( is_even, (14) ); int i = 17; - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( is_even, (i) ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test is_even( i ) failed for ( 17 )\n", 2 ) ) - ); + BOOST_CHECK_PREDICATE( is_even, (i) ); using std::not_equal_to; - - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( not_equal_to(), (i)(17) ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test not_equal_to()( i, 17 ) failed for ( 17, 17 )\n", 2 ) ) - ); + BOOST_CHECK_PREDICATE( not_equal_to(), (i)(17) ); int j=15; - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( boost::bind( is_even, boost::bind( &foo, _1, _2 ) ), (i)(j) ), - output.is_empty() - ); + BOOST_CHECK_PREDICATE( boost::bind( is_even, boost::bind( &foo, _1, _2 ) ), (i)(j) ); unit_test_log.set_threshold_level( log_warnings ); - - CHECK_TOOL_USAGE( - BOOST_WARN_PREDICATE( moo, (12)(i)(j) ), - output.is_equal( CHECK_PATTERN( - "warning in " TEST_CASE_NAME ": condition moo( 12, i, j ) is not satisfied for ( 12, 17, 15 )\n", 3 ) ) - ); + BOOST_WARN_PREDICATE( moo, (12)(i)(j) ); unit_test_log.set_threshold_level( log_all_errors ); - std::list l1, l2, l3; l1.push_back( 1 ); l3.push_back( 1 ); l1.push_back( 2 ); l3.push_back( 3 ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_PREDICATE( compare_lists, (l1)(l2) ), - output.is_equal( CHECK_PATTERN( "error in " TEST_CASE_NAME ": test compare_lists( l1, l2 ) failed for ( , ). Different sizes [2!=0]\n", 2 ) ) - ); + BOOST_CHECK_PREDICATE( compare_lists, (l1)(l2) ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_REQUIRE_PREDICATE ) +TEST_CASE( test_BOOST_REQUIRE_PREDICATE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_REQUIRE_PREDICATE" << qu << - int arg1 = 1; int arg2 = 2; using std::less_equal; + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_PREDICATE( less_equal(), (arg1)(arg2) ) ); - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_PREDICATE( less_equal(), (arg1)(arg2) ), - output.is_empty(), false - ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_PREDICATE( less_equal(), (arg2)(arg1) ), - false, output.is_equal( CHECK_PATTERN( - "fatal error in " TEST_CASE_NAME ": critical test less_equal()( arg2, arg1 ) " - "failed for ( " << arg2 << ", " << arg1 << " )\n", 4 ) ) - ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_PREDICATE( less_equal(), (arg2)(arg1) ) ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_EQUAL_COLLECTIONS ) +TEST_CASE( test_BOOST_CHECK_EQUAL_COLLECTIONS ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_EQUAL_COLLECTIONS" << qu << - unit_test_log.set_threshold_level( log_all_errors ); int pattern [] = { 1, 2, 3, 4, 5, 6, 7 }; @@ -667,67 +427,23 @@ BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_EQUAL_COLLECTIONS ) testlist.push_back( 7 ); // 6 testlist.push_back( 7 ); - boost::wrap_stringstream ptrn; - - ptrn << "error in " TEST_CASE_NAME ": test { testlist.begin(), testlist.end() } == { pattern, pattern+7 } failed. " - << "\nMismatch in a position 2: 4 != 3" - << "\nMismatch in a position 5: 7 != 6\n"; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+7 ), - output.is_equal( CHECK_PATTERN( ptrn.str(), 2 ) ) - ); - - boost::wrap_stringstream ptrn1; - - ptrn1 << "error in " TEST_CASE_NAME ": test { testlist.begin(), testlist.end() } == { pattern, pattern+2 } failed. " - << "\nCollections size mismatch: 7 != 2\n"; - - CHECK_TOOL_USAGE( - BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+2 ), - output.is_equal( CHECK_PATTERN( ptrn1.str(), 2 ) ) - ); + BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+7 ); + BOOST_CHECK_EQUAL_COLLECTIONS( testlist.begin(), testlist.end(), pattern, pattern+2 ); } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECK_BITWISE_EQUAL ) +TEST_CASE( test_BOOST_CHECK_BITWISE_EQUAL ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECK_BITWISE_EQUAL" << qu << + BOOST_CHECK_BITWISE_EQUAL( 0x16, 0x16 ); - CHECK_TOOL_USAGE( - BOOST_CHECK_BITWISE_EQUAL( 0x16, 0x16 ), - output.is_empty() - ); - - CHECK_TOOL_USAGE( - BOOST_CHECK_BITWISE_EQUAL( (char)0x06, (char)0x16 ), - output.is_equal( - CHECK_PATTERN( "error in " TEST_CASE_NAME ": test (char)0x06 =.= (char)0x16 failed. \nMismatch in a position 4\n", 3 ) ) - ); + BOOST_CHECK_BITWISE_EQUAL( (char)0x06, (char)0x16 ); unit_test_log.set_threshold_level( log_warnings ); - - CHECK_TOOL_USAGE( - BOOST_WARN_BITWISE_EQUAL( (char)0x26, (char)0x04 ), - output.is_equal( - CHECK_PATTERN( "warning in " TEST_CASE_NAME ": condition (char)0x26 =.= (char)0x04 is not satisfied. " - "\nMismatch in a position 1" - "\nMismatch in a position 5\n", 5 ) ) - ); - - unit_test_log.set_threshold_level( log_all_errors ); - - CHECK_CRITICAL_TOOL_USAGE( - BOOST_REQUIRE_BITWISE_EQUAL( (char)0x26, (int)0x26 ), - false, - output.is_equal( - CHECK_PATTERN( "fatal error in " TEST_CASE_NAME ": critical test (char)0x26 =.= (int)0x26 failed. " - "\nOperands bit sizes mismatch: 8 != 32\n", 5 ) ) - ); + BOOST_WARN_BITWISE_EQUAL( (char)0x26, (char)0x04 ); unit_test_log.set_threshold_level( log_all_errors ); + CHECK_CRITICAL_TOOL_USAGE( BOOST_REQUIRE_BITWISE_EQUAL( (char)0x26, (int)0x26 ) ); } //____________________________________________________________________________// @@ -736,84 +452,38 @@ struct A { friend std::ostream& operator<<( std::ostream& str, A const& a ) { str << "struct A"; return str;} }; -BOOST_AUTO_UNIT_TEST( test_BOOST_MESSAGE ) +TEST_CASE( test_BOOST_MESSAGE ) { -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_REQUIRE" << qu << - unit_test_log.set_threshold_level( log_messages ); - CHECK_TOOL_USAGE( - BOOST_MESSAGE( "still testing" ), - output.is_equal( "still testing\n" ) - ); - - CHECK_TOOL_USAGE( - BOOST_MESSAGE( "1+1=" << 2 ), - output.is_equal( "1+1=2\n" ) - ); + BOOST_MESSAGE( "still testing" ); + BOOST_MESSAGE( "1+1=" << 2 ); int i = 2; - CHECK_TOOL_USAGE( - BOOST_MESSAGE( i << "+" << i << "=" << (i+i) ), - output.is_equal( "2+2=4\n" ) - ); + BOOST_MESSAGE( i << "+" << i << "=" << (i+i) ); A a = A(); - CHECK_TOOL_USAGE( - BOOST_MESSAGE( a ), - output.is_equal( "struct A\n" ) - ); + BOOST_MESSAGE( a ); #if !defined(BOOST_NO_STD_LOCALE) && ( !defined(BOOST_MSVC) || BOOST_WORKAROUND(BOOST_MSVC, >= 1310)) - - CHECK_TOOL_USAGE( - BOOST_MESSAGE( std::hex << std::showbase << 20 ), - output.is_equal( "0x14\n" ) - ); - + BOOST_MESSAGE( std::hex << std::showbase << 20 ); #endif - CHECK_TOOL_USAGE( - BOOST_MESSAGE( std::setw( 4 ) << 20 ), - output.is_equal( " 20\n" ) - ); + BOOST_MESSAGE( std::setw( 4 ) << 20 ); } //____________________________________________________________________________// -class bad_func_container : public test_case +TEST_CASE( test_BOOST_CHECKPOINT ) { -public: - bad_func_container() : test_case( "test_BOOST_CHECKPOINT", true, 1 ) {} - void do_run() { - throw "some error"; - } -} bad; - -BOOST_AUTO_UNIT_TEST( test_BOOST_CHECKPOINT ) -{ -#undef TEST_CASE_NAME -#define TEST_CASE_NAME << qu << "test_BOOST_CHECKPOINT" << qu << - - unit_test_log.set_threshold_level( log_all_errors ); - BOOST_CHECKPOINT( "Going to do a silly things" ); - boost::wrap_stringstream ptrn; - ptrn << "Exception in " TEST_CASE_NAME ": C string: some error\n" - << normalize_file_name( __FILE__ ) << "(" << (__LINE__ - 4) << "): " - << "last checkpoint: Going to do a silly things\n"; - - CHECK_TOOL_USAGE( - bad.run(), - output.is_equal( ptrn.str() ) - ); + throw "some error"; } //____________________________________________________________________________// -BOOST_AUTO_UNIT_TEST( test_BOOST_IS_DEFINED ) +TEST_CASE( test_BOOST_IS_DEFINED ) { #define SYMBOL1 #define SYMBOL2 std::cout @@ -833,21 +503,11 @@ BOOST_AUTO_UNIT_TEST( test_BOOST_IS_DEFINED ) // *************************************************************************** // Revision History : -// +// // $Log$ -// Revision 1.38 2005/01/31 06:04:31 rogeeff -// workaround fixed +// Revision 1.39 2005/02/20 08:28:34 rogeeff +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates // -// Revision 1.37 2005/01/30 03:35:55 rogeeff -// no message -// -// Revision 1.35 2005/01/18 08:30:09 rogeeff -// unit_test_log rework: -// eliminated need for ::instance() -// eliminated need for << end and ...END macro -// straitend interface between log and formatters -// change compiler like formatter name -// minimized unit_test_log interface and reworked to use explicit calls // *************************************************************************** // EOF