Lely core libraries 2.3.4
tap.h File Reference

This is the public header file of the Test Anything Protocol (TAP) library. More...

#include <lely/features.h>
Include dependency graph for tap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TAP_ARGS_HAS_COMMA(...)
 Evaluates to 1 if the argument list contains a comma, and 0 if not.
 
#define TAP_ARGS_DEFAULT(arg, ...)    TAP_ARGS_DEFAULT_(TAP_ARGS_HAS_COMMA(__VA_ARGS__), arg, __VA_ARGS__)
 Appends arg if the variadic argument list contains a single argument.
 
#define tap_plan(...)   tap_plan_(TAP_ARGS_DEFAULT("", __VA_ARGS__))
 Specifies the test plan.
 
#define tap_test(...)   tap_test_(TAP_ARGS_DEFAULT("", __VA_ARGS__))
 Evaluates an expression.
 
#define tap_pass(...)   tap_test_impl(1, "", __FILE__, __LINE__, "" __VA_ARGS__)
 Indicates that a test has passed.
 
#define tap_fail(...)   tap_test_impl(0, "", __FILE__, __LINE__, "" __VA_ARGS__)
 Indicates that a test has failed.
 
#define tap_todo(...)   tap_todo_(TAP_ARGS_DEFAULT("", __VA_ARGS__))
 Indicates that a test is expected to fail.
 
#define tap_skip(...)   tap_skip_(TAP_ARGS_DEFAULT("", __VA_ARGS__))
 Skips a test.
 
#define tap_diag(...)   tap_diag_impl("# " __VA_ARGS__)
 Emits a diagnostic message.
 
#define tap_abort(...)   tap_abort_impl("" __VA_ARGS__)
 Aborts all tests.
 
#define tap_assert(expr)
 Similar to assert(), but invokes tap_abort() if expr evaluates to zero.
 

Detailed Description

This is the public header file of the Test Anything Protocol (TAP) library.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file tap.h.

Macro Definition Documentation

◆ tap_plan

#define tap_plan (   ...)    tap_plan_(TAP_ARGS_DEFAULT("", __VA_ARGS__))

Specifies the test plan.

The first argument MUST be the number of test to run. If no tests are run, a second argument MAY be provided. If it is, it is interpreted as a printf-style format string describing the reason for skipping the tests. Any further arguments are printed under the control of the format string.

Definition at line 85 of file tap.h.

◆ tap_test

#define tap_test (   ...)    tap_test_(TAP_ARGS_DEFAULT("", __VA_ARGS__))

Evaluates an expression.

If the result is non-zero, the test passed, otherwise it failed. The first argument MUST be the expression to be evaluated. The second argument is optional. If it is specified, it is interpreted as a printf-style format string describing the test. Any further arguments are printed under the control of the format string.

Definition at line 96 of file tap.h.

◆ tap_pass

#define tap_pass (   ...)    tap_test_impl(1, "", __FILE__, __LINE__, "" __VA_ARGS__)

Indicates that a test has passed.

No arguments are required, but if they are specified, the first argument is interpreted as a printf-style format string describing the test. Any further arguments are printed under the control of the format string.

See also
tap_fail()

Definition at line 109 of file tap.h.

◆ tap_fail

#define tap_fail (   ...)    tap_test_impl(0, "", __FILE__, __LINE__, "" __VA_ARGS__)

Indicates that a test has failed.

No arguments are required, but if they are specified, the first argument is interpreted as a printf-style format string describing the test. Any further arguments are printed under the control of the format string.

See also
tap_pass()

Definition at line 119 of file tap.h.

◆ tap_todo

#define tap_todo (   ...)    tap_todo_(TAP_ARGS_DEFAULT("", __VA_ARGS__))

Indicates that a test is expected to fail.

If the expression evaluates to zero, the test is not considered to have failed. The arguments are the same as for tap_test().

Definition at line 126 of file tap.h.

◆ tap_skip

#define tap_skip (   ...)    tap_skip_(TAP_ARGS_DEFAULT("", __VA_ARGS__))

Skips a test.

The provided expression is not evaluated. The arguments are the same as for tap_test().

Definition at line 136 of file tap.h.

◆ tap_diag

#define tap_diag (   ...)    tap_diag_impl("# " __VA_ARGS__)

Emits a diagnostic message.

The first argument, if provided, is interpreted as a printf-style format string. Any further arguments are printed under the control of the format string.

Definition at line 145 of file tap.h.

◆ tap_abort

#define tap_abort (   ...)    tap_abort_impl("" __VA_ARGS__)

Aborts all tests.

The first argument, if provided, is interpreted as a printf-style format string describing the reason for aborting. Any further arguments are printed under the control of the format string. Note that this function aborts the running process and does not return.

Definition at line 153 of file tap.h.