Boost Test Library: unit_test_example3 example

Boost.Test > Examples > unit_test_example3

# The Unit Test Framework example 3

Rationale:

to demonstrate

- an ability to construct multilevel hierarchy of test suites
- an ability to construct test cases based on user class's member function
- an ability to fail test suite initialization
- usage of several different kinds of Test Tools
- usage of floating point comparison algorithm

Input: | 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.

Output:

With the input described above the output looks like:
Running 3 test case...
.../unit_test_example3.cpp(63): error in "account_test::test_init": test m_account.balance() == 5.0 failed [10 != 5]
Enter deposit value:
5
.../unit_test_example3.cpp(87): fatal error in "account_test::test_deposit": test m_account.balance() >= 100.0 failed
*** 2 failures detected (5 failures expected) in test suite "Unit test example 3"

Source: | unit_test_example3.cpp