[/
 / Copyright (c) 2003 Boost.Test contributors
 /
 / 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)
 /]

[section:enabling Enabling or disabling test unit execution]

The __UTF__ provides a way for enabling or disabling a test unit execution. If a test case is disabled, it will not be
run by the test runner. If a test suite is disabled, its status is inherited by the test units under its subtree, unless
otherwise specified.

The run status can be overridden by the command line parameters: by providing the appropriate arguments to the command
line, a disabled test may still be executed. The [link boost_test.runtime_config.test_unit_filtering test unit
filtering] section covers this feature in details.

[warning There is a difference between a disabled test and a skipped test:

  * a disabled test has a run status set to disabled, and is completely discarded by the __UTF__.
  * a skipped test is a test that has a run status set to enabled, but which execution has been skipped at runtime.
]

[h3 Unconditional run status]
Decorator __decorator_disabled__ indicates that the test unit's __default_run_status__ is ['false]. This means that that
test cases inside this test unit will not be run by default, unless otherwise specified. Decorator __decorator_enabled__
indicates that the test unit's default run status is ['true]. This means that that test cases inside this test unit will
be run by default, unless otherwise specified.

[bt_example decorator_05..decorators enabled and disabled..run-fail]

Syntactically, it is possible to apply both decorators `enabled` and `disabled` to the same test unit. This is reported
as set-up error when the test program is run.

[h3 Compilation-time run status]

Decorator __decorator_enable_if__ indicates that the test unit's __default_run_status__ is either ['true] or ['false],
depending on the value of `Condition`. This means that that test cases inside this test unit will or will not be run by
default.


[bt_example decorator_06..decorator enable_if..run-fail]

Decorator `enable_if<true>()` is equivalent to decorator `enabled()`. Similarly, `enable_if<false>()` is equivalent to
decorator `disabled()`.

[/-----------------------------------------------------------------]
[h3 Runtime run status]

Decorator __decorator_precondition__ associates a ['predicate] with a test unit. Before the test unit is executed, the
predicate is evaluated with the test unit's ID passed as the argument. If it evaluates to `false`, execution of the test
unit is skipped. Skipping a test suite means skipping the execution of every test unit inside.

[tip The precondition may return an [classref boost::test_tools::assertion_result assertion_result] instead of a boolean.
 In that case, the message contained in the `assertion_result` will be printed by the __UTF__.]

[bt_example decorator_08..decorator precondition..run-fail]

In the example above, the user defined a custom predicate `if_either` that evaluates to `true` if at least one of the two
specified tests passed. (It assumes that the tests are registered in the specific order.)

* Test case `test3` has a precondition that at either `test1` or `test2` passed. The precondition is satisfied,
  therefore `test3` is run (and fails),
* test case `test4` has a precondition that either `test2` or `test3` passed. Since they both failed, the
  precondition is not satisfied, therefore `test4` is skipped.

[note A __decorator_precondition__ that evaluates to `false` does not yield an error and does not fail the attached unit test. However
 the __UTF__ returns an error if the test tree is empty (see [link boost_test.tests_organization.test_tree.test_tree_content this section]
 for more details). ]

[endsect]
