mirror of
https://github.com/boostorg/test.git
synced 2026-01-25 18:52:15 +00:00
Components examples and test page introduced and incorporated Several spelling errors fixed [SVN r17359]
905 lines
35 KiB
HTML
905 lines
35 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<HTML>
|
|
|
|
<HEAD>
|
|
<TITLE>Examples and tests</TITLE>
|
|
|
|
<LINK rel="stylesheet" type="text/css" href="style/btl-white.css" media="screen">
|
|
<LINK rel="stylesheet" type="text/css" href="style/btl-print.css" media="print">
|
|
|
|
<META http-equiv="Content-Language" content="en-us">
|
|
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
</HEAD>
|
|
|
|
<BODY>
|
|
<DIV class="centered">
|
|
<TABLE class="body-table" cellspacing="3" >
|
|
<TR>
|
|
<TD id="body"><A name='TOP'><IMG src='../../../c++boost.gif' width='277' height='86' alt="Boost logo"></A>
|
|
<H1>Boost Test Library: examples and tests</H1>
|
|
<P class="page-toc"> <A href="index.htm">Home</A><BR>
|
|
<A href="#Examples">Examples</A></P>
|
|
<P class="page-toc-indented"><A href="#prog_exec_monitor_example">Program Execution Monitor example</A><BR>
|
|
<A href="#test_exec_monitor_example">Test Execution Monitor example</A><BR>
|
|
<A href="#unit_test_example1">Unit Test Framework example 1</A><BR>
|
|
<A href="#unit_test_example2">Unit Test Framework example 2</A><BR>
|
|
<A href="#unit_test_example3">Unit Test Framework example 3</A><BR>
|
|
<A href="#unit_test_example4">Unit Test Framework example 4</A><BR>
|
|
<A href="#unit_test_example5">Unit Test Framework example 5</A><BR>
|
|
</P>
|
|
<P class="page-toc"> <A href="#Tests">Tests</A></P>
|
|
<P class="page-toc-indented"><A href="#prg_exec_fail1">The Program Execution Monitor test 1</A><BR>
|
|
<A href="#prg_exec_fail2">The Program Execution Monitor test 2</A><BR>
|
|
<A href="#prg_exec_fail3">The Program Execution Monitor test 3</A><BR>
|
|
<A href="#test_exec_fail1">The Test Execution Monitor test 1</A><BR>
|
|
<A href="#test_exec_fail2">The Test Execution Monitor test 2</A><BR>
|
|
<A href="#test_exec_fail3">The Test Execution Monitor test 3</A><BR>
|
|
<A href="#test_exec_fail4">The Test Execution Monitor test 4</A><BR>
|
|
<A href="#test_tools_test">The Test Tools Test</A><BR>
|
|
<A href="#online_test">The Unit Test Framework online test</A><BR>
|
|
<A href="#output_test_stream_test">The Unit Test Framework output test stream test</A><BR>
|
|
<A href="#result_report_test">The Unit Test Framework result report test</A><BR>
|
|
<A href="#unit_test_suite_ex_test">The Unit Test Framework extension test</A><BR>
|
|
<A href="#errors_handling_test">The Unit Test Framework errors handling test</A><BR>
|
|
<A href="#auto_unit_test_test">The Unit Test Framework automated registration feature test</A><BR>
|
|
<A href="#minimal_test">The Minimal Testing facility unit test</A><BR>
|
|
<A href="#parameterized_test_test">The test for creating and using parameterized test cases</A><BR>
|
|
<A href="#test_fp_comparisons">The floating point comparisons test</A><BR>
|
|
</P>
|
|
|
|
<H2><A name="Examples">Examples</A></H2>
|
|
<P class="1-line-indented">The following list provides cumulative summary
|
|
information on all Boost Test Library examples. Summary contains rationale
|
|
section describing the main purpose of an example. Input section describe
|
|
what input is required for the example. Output section presents expected output from the example
|
|
program run with the input specified in input section. To compile all example programs you could
|
|
use Jamfile supplied in examples directory.</P>
|
|
|
|
<H3>1. <A name="prog_exec_monitor_example">The Program Execution Monitor example</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title">Rationale:</TD>
|
|
<TD>to demonstrate that the only change you need to start using program
|
|
execution monitor is the name of your main function</TD>
|
|
</TR>
|
|
<TR><TD class="title">Input:</TD>
|
|
<TD>This example does not require any input</TD>
|
|
</TR>
|
|
<TR><TD class="title">Output:</TD>
|
|
<TD><SPAN class="test-output">no errors expected</SPAN></TD>
|
|
</TR>
|
|
<TR><TD class="title">Source:</TD>
|
|
<TD><A href="../example/prg_exec_example.cpp">prg_exec_example.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>2. <A name="test_exec_monitor_example">The Test Execution Monitor example</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title">Rationale:</TD>
|
|
<TD>demonstrate how to write test programs using test execution monitor and six ways to detect and report the same error</TD>
|
|
</TR>
|
|
<TR><TD class="title">Input:</TD>
|
|
<TD>This example does not require any input</TD>
|
|
</TR>
|
|
<TR><TD class="title">Output:</TD>
|
|
<TD><SPAN class="test-output">*** No errors expected</SPAN></TD>
|
|
</TR>
|
|
<TR><TD class="title">Source:</TD>
|
|
<TD><A href="../example/test_exec_example.cpp">test_exec_example.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>3. <A name="unit_test_example1">The Unit Test Framework example 1</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>this simple introductory example demonstrate several basic concepts of unit test framework:
|
|
<UL><LI>usage of init_unit_test_framework to create and initialize test suite</LI>
|
|
<LI>test case creation based on free function</LI>
|
|
<LI>usage of basic test tools in test case</LI>
|
|
<LI>usage of "number of expected failures" feature </LI>
|
|
</UL>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Input:</TD>
|
|
<TD>This example does not require any input</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Output:</TD>
|
|
<TD><SPAN class="test-output">Running 1 test case...<BR>
|
|
.../unit_test_example1.cpp(17): error in "free_test_function": test 2 == 1 failed<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../example/unit_test_example1.cpp">unit_test_example1.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>4. <A name="unit_test_example2">The Unit Test Framework example 2</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>to demonstrate
|
|
<UL><LI>an ability to construct multi-test case test suites</LI>
|
|
<LI>an ability of unit test framework to catch system level errors like floating point exceptions or dead loop.</LI>
|
|
<LI>usage of BOOST_CHECKPOINT test tool to mark exception risky places</LI>
|
|
</UL>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Input:</TD>
|
|
<TD>This example does not require any input</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Output:</TD>
|
|
<TD>The output depends on whether or not your system support setting test case timeout. For Win32 it will look like this:<BR>
|
|
<SPAN class="test-output">Running 2 test case...<BR>
|
|
Exception in "force_division_by_zero": integer divide by zero<BR>
|
|
.../unit_test_example2.cpp(16) : last checkpoint: About to force division by zero!<BR><BR>
|
|
*** errors detected in test suite "Unit test example 2"; see standard output for details
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../example/unit_test_example2.cpp">unit_test_example2.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>5. <A name="unit_test_example3">The Unit Test Framework example 3</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>to demonstrate
|
|
<UL><LI>an ability to construct multi-level hierarchy of test suites</LI>
|
|
<LI>an ability to construct test cases based on user class's member function</LI>
|
|
<LI>an ability to fail test suite initialization.</LI>
|
|
<LI>usage of several different kinds of Test Tools</LI>
|
|
<LI>usage of floating point comparison algorithm</LI>
|
|
</UL>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Input:</TD>
|
|
<TD>This example require initial balance as a command line argument. Also during run it query deposit value. You may
|
|
use 10 and 5 to get an output below.</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Output:</TD>
|
|
<TD>With the input described above the output looks like:<BR>
|
|
<SPAN class="test-output">Running 3 test case...<BR>
|
|
.../unit_test_example3.cpp(63): error in "account_test::test_init": test m_account.balance() == 5.0 failed [10 != 5]<BR>
|
|
Enter deposit value:<BR>
|
|
5<BR>
|
|
.../unit_test_example3.cpp(87): fatal error in "account_test::test_deposit": test m_account.balance() >= 100.0 failed<BR><BR>
|
|
*** 2 failures detected (5 failures expected) in test suite "Unit test example 3"
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../example/unit_test_example3.cpp">unit_test_example3.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>6. <A name="unit_test_example4">The Unit Test Framework example 4</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>to demonstrate how to construct parameterized test case based on free function test case and where to store the parameters
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Input:</TD>
|
|
<TD>This example does not require any input</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Output:</TD>
|
|
<TD>The output depends on whether or not your system support setting test case timeout. For Win32 it will look like this:<BR>
|
|
<SPAN class="test-output">Running 1 test case...<BR>
|
|
.../unit_test_example4.cpp(20): error in "check_string": test s.substr( 0, 3 ) == "hdr" failed [3 != hdr]<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../example/unit_test_example4.cpp">unit_test_example4.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>7. <A name="unit_test_example5">The Unit Test Framework example 5</A></H3>
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>this moderately complex example presents test program for the family of trivial hash functions. On the way
|
|
among other things it demonstrates:<BR>
|
|
<UL><LI>an ability to construct parameterized test cases based on user class's member function</LI>
|
|
<LI>usage of shared instance of user test case</LI>
|
|
<LI>ability to store test case parameters in user test case</LI>
|
|
</UL>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Input:</TD>
|
|
<TD>This example not require input in a following format:<BR>
|
|
alphabet<BR>
|
|
string hash-value<BR>
|
|
string hash-value<BR>
|
|
...<BR><BR>
|
|
|
|
hash-value is positive integer. hash-value -1 designate expected "wrong length" error. <BR>
|
|
hash-value -2 designate expected "non-alphabet letter in string" error. Here is an example input:<BR>
|
|
<A href="../example/unit_test_example5.input">unit_test_example5.input</A>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Output:</TD>
|
|
<TD>If you use supplied input like this: unit_test_example5 < unit_test_example5.input, you will get:<BR>
|
|
<SPAN class="test-output">Enter alphabet (4 characters without
|
|
delimiters)<BR><BR>
|
|
Enter test data in a format [string] [value] to check correct calculation<BR>
|
|
Enter test data in a format [string] -1 to check long string validation<BR>
|
|
Enter test data in a format [string] -2 to check invalid argument string validation<BR><BR>
|
|
Running 1 test case...<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../example/unit_test_example5.cpp">unit_test_example5.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H2><A name="Tests">Tests</A></H2>
|
|
<P class="1-line-indented">The following list provides cumulative summary
|
|
information on all Boost Test Library tests. Summary consist of the following parts:</P>
|
|
|
|
<TABLE class="test-example-summary" >
|
|
<TR>
|
|
<TD class="title" valign="top">Rationale</TD>
|
|
<TD>intent of the test</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Type</TD>
|
|
<TD>type of the test:
|
|
<UL>
|
|
<LI>run-time - should succeed at run time</LI>
|
|
<LI>run-time-failure - should fail at run time</LI>
|
|
<LI>compile-time - should succeed to compile and link</LI>
|
|
</UL>
|
|
</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Component needed</TD>
|
|
<TD>Component of the Boost Test Library this test need to be linked with</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Need Test Pattern</TD>
|
|
<TD>yes/no depends on whether this test require pattern file name ass first command line
|
|
argument. Pattern files are located in test directory along with test source file. Click on 'yes' and you will see it.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Expected Output</TD>
|
|
<TD>expected output produced by test during run.</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Result Code</TD>
|
|
<TD>result code returned by the test</TD>
|
|
</TR>
|
|
<TR>
|
|
<TD class="title" valign="top">Source</TD>
|
|
<TD>Link to the test source file.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<P class="1-line-indented">To compile all test programs you could use Jamfile supplied in test directory.</P>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>1. <A name="prg_exec_fail1">The Program Execution Monitor test 1</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Program Execution Monitor to catch a
|
|
user exception</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Program Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output"><BR>*** Error: C string: Test error by throwing C-style string exception<BR><BR>
|
|
**** error return code 205<BR>
|
|
********** errors detected; see standard output for details ***********
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>205</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/prg_exec_fail1.cpp">prg_exec_fail1.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>2. <A name="prg_exec_fail2">The Program Execution Monitor test 2</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Program Execution Monitor to catch a
|
|
system exception</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Program Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>
|
|
no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output"><BR>*** Error: integer divide by zero<BR><BR>
|
|
**** error return code 210<BR>
|
|
********** errors detected; see standard output for details ***********
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>205</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/prg_exec_fail2.cpp">prg_exec_fail2.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>3. <A name="prg_exec_fail3">The Program Execution Monitor test 3</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Program Execution Monitor to
|
|
gracefully catch an asserts fired by the user</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>
|
|
<TT>the Program Execution Monitor</TT></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>
|
|
no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">Assertion failed: div != 0, file d:\source code\boost\libs\test\test\prg_exec_fail3.cpp, line 23<BR><BR>
|
|
**** Error:<BR><BR>
|
|
abnormal program termination<BR><BR><BR>
|
|
**** error return code 210<BR>
|
|
********** errors detected; see standard output for details ***********
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>210</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/prg_exec_fail3.cpp">prg_exec_fail3.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>4. <A name="test_exec_fail1">The Test Execution Monitor test 1</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Test Execution Monitor to catch non-zero return code from test_main</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>
|
|
<TT>the Test Execution Monitor</TT></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>
|
|
no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">.../test_main.cpp(40): error in "call_test_main": test test_main_result == 0
|
|
|| test_main_result == boost::exit_success failed<BR><BR>
|
|
*** 1 failure detected in test case "call_test_main"
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>1</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_exec_fail1.cpp">test_exec_fail1.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>5. The <A name="test_exec_fail2">Test Execution Monitor test 2</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Test Execution Monitor to catch and report test
|
|
errors using the Test Tools</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>
|
|
<TT>the Test Execution Monitor</TT></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>
|
|
no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">.../test_exec_fail2.cpp(25): error in "call_test_main": test v == 2 failed<BR>
|
|
.../test_exec_fail2.cpp(26): error in "call_test_main": sample BOOST_ERROR call<BR>
|
|
.../test_exec_fail2.cpp(27): fatal error in "call_test_main": test 2 == v failed<BR><BR>
|
|
*** 3 failures detected in test case "call_test_main"
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>201</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_exec_fail2.cpp">test_exec_fail2.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>6. <A name="test_exec_fail3">The Test Execution Monitor test 3</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Test Execution Monitor to report test failures generated by BOOST_CHECK</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>
|
|
<TT>the Test Execution Monitor</TT></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
.../test_exec_fail3.cpp(24): error in "call_test_main": test v == 2 failed<BR>
|
|
.../test_exec_fail3.cpp(25): error in "call_test_main": test 2 == v failed<BR><BR>
|
|
*** 2 failures detected in test case "call_test_main"
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>201</span></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_exec_fail3.cpp">test_exec_fail3.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>7. <A name="test_exec_fail4">The Test Execution Monitor test 4</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to check an ability of the Test Execution Monitor to catch and report exceptions in tests</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Test Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
.../test_exec_fail4.cpp(23): error in "call_test_main": Msg<BR>
|
|
Exception in "call_test_main": C string: Test error by throwing C-style string exception<BR><BR>
|
|
*** 1 failure detected in test case "call_test_main"<BR>
|
|
Test case "call_test_main" was aborted due to uncaught exception, user assert or system error<BR>
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>201</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_exec_fail4.cpp">test_exec_fail4.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>8. <A name="test_tools_test">The Test Tools test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>detailed self test for the Test Tools. Intended to check that every test tool is working
|
|
properly, i.e. catch what is supposed to catch and report the way it is supposed to report.
|
|
Due to self test nature the result code will always be non zero. The presence of errors
|
|
is detected by presence of lines with errors
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Unit Test Framework</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">Running 17 test cases...<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_tools_test.cpp">test_tools_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>9. <A name="online_test">The Unit Test Framework online test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to demonstrate how to use the included version of the Program Execution Monitor
|
|
(vs. linked as a separate library). It's compile-time check. Once compiled and linked it passed.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>compile-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>none</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/online_test.cpp">online_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>10. <A name="output_test_stream_test">The Unit Test Framework output test stream test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>detailed self test for output_test_stream Test Tool. Validate that all test mechanisms working properly.
|
|
Include 5 test cases: test_constructor, test_is_empty, test_check_length, test_is_equal, test_match_pattern.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Unit Test Framework</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no, but will generate 2 files automatically.</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">Running 5 test cases...<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/output_test_stream_test.cpp">output_test_stream_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>11. <A name="result_report_test">The Unit Test Framework result report test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>the Unit Test Framework reporting facilities testing. Check that all reports (short, conformation, detailed) are
|
|
constructed as expected. To do this output is matched vs. pattern file. The pattern file result_report_test.pattern
|
|
is located in test directory. It's name should be supplied as a first
|
|
argument to program. To run test in a match mode
|
|
(default) you does not need to provide any more arguments. To run test in save mode (this way you could generate pattern file)
|
|
run test with the additional argument: --save_pattern=yes.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Test Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD><a href="../test/result_report_test.pattern">yes</a></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output"><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/result_report_test.cpp">result_report_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>12. <A name="unit_test_suite_ex_test">The Unit Test Framework extension test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intend to perform test functionality presented in a header unit_test_suite_ex.hpp
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Unit Test Framework</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">Running 2 test cases...<BR><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/unit_test_suite_ex_test.cpp">unit_test_suite_ex_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>13. <A name="errors_handling_test">The Unit Test Framework errors handling test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to test that the Unit Test Framework properly handle different errors during different
|
|
stages of testing. Testing output is matched the pattern file. The pattern file is located in test
|
|
directory. To run test in a match mode (default) you does not need to provide any more arguments.
|
|
To run test in save mode (this way you could generate pattern file) run test with the additional
|
|
argument: --save_pattern=yes.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Test Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD><a href="../test/errors_handling_test.pattern">yes</a></TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output"><BR>
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/errors_handling_test.cpp">errors_handling_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>14. <A name="auto_unit_test_test">The Unit Test Framework automated registration feature test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intended to demonstrate and test automated registration of test cases feature of the Unit Test Framework.
|
|
It's compile-time check. Once compiled and linked it passed.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>compile-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Unit Test Framework</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/auto_unit_test_test.cpp">auto_unit_test_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>15. <A name="minimal_test">The Minimal Testing facility unit test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>intend to perform the detailed test and demonstrate usage of the minimal testing facility
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time-failure</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>none</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
.../minimal_test.cpp(56): test i == 2 failed<BR>
|
|
.../minimal_test.cpp(59): test bool_convertible1( false ) failed<BR>
|
|
.../minimal_test.cpp(62): test bool_convertible2( 0 ) failed<BR>
|
|
.../minimal_test.cpp(65): test bool_convertible3( NULL ) failed<BR>
|
|
.../minimal_test.cpp(67): Some error<BR>
|
|
.../minimal_test.cpp(69): test i == 4 failed<BR>
|
|
<BR>
|
|
**** Testing aborted.<BR>
|
|
**** 6 errors detected<BR>
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>201</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/minimal_test.cpp">minimal_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>16. <A name="parameterized_test_test">The test for creating and using parameterized test cases</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>test creation and usage of all kinds of parameterized test cases
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Test Execution Monitor</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD><SPAN class="test-output">
|
|
*** No errors detected
|
|
</SPAN>
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/parameterized_test_test.cpp">parameterized_test_test.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<SPAN class="ref-to-top"><A href="#TOP"><IMG src="imgs/uarrow.gif" alt="reference to the top"></A></SPAN>
|
|
|
|
<H3>17. <A name="test_fp_comparisons">The floating point comparisons test</A></H3>
|
|
|
|
<TABLE class="test-example-summary">
|
|
<TR><TD class="title" valign="top">Rationale:</TD>
|
|
<TD>test floating point comparisons algorithms and tools. For some reason failing at the moment.
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Type:</TD>
|
|
<TD>run-time</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Component needed:</TD>
|
|
<TD>the Unit Test Framework</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Need Test Pattern:</TD>
|
|
<TD>no</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Expected Output:</TD>
|
|
<TD>Output differ depends on compiler
|
|
</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Result Code:</TD>
|
|
<TD>0</TD>
|
|
</TR>
|
|
<TR><TD class="title" valign="top">Source:</TD>
|
|
<TD><A href="../test/test_fp_comparisons.cpp">test_fp_comparisons.cpp</A></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<DIV class="footer">
|
|
<P>© <A href='mailto:rogeeff@emailaccount.com'>Gennadiy Rozental</A>
|
|
2001-2002
|
|
</P>
|
|
|
|
<P>Revised: 12 February, 2003
|
|
</P>
|
|
</DIV>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
</DIV>
|
|
</BODY>
|
|
</HTML> |