Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

xtests/xtests.h File Reference


Detailed Description

[C, C++] Simple unit/component-testing library.

#include <stlsoft/stlsoft.h>
#include <platformstl/platformstl.h>
#include <stlsoft/meta/is_integral_type.hpp>
#include <stlsoft/meta/is_same_type.hpp>
#include <stlsoft/meta/select_first_type_if.hpp>
#include <stlsoft/shims/access/string.hpp>
#include <new>
#include <stdexcept>
#include <stdio.h>

Go to the source code of this file.

Defines

#define _XTESTS_VER_MAJOR   0
 The Major version number of the xTests library.
#define _XTESTS_VER_MINOR   10
 Minor version number of the xTests library.
#define _XTESTS_VER_REVISION   3
 The revision number of the xTests library.
#define _XTESTS_VER   0x000a03ff
 The composite version of the xTests library.
#define XTESTS_FP_APPROXIMATE_FACTOR   (1.000001)
 The factor within which floating point numbers are deemed to be approximately equal.
#define XTESTS_START_RUNNER(name, verbosity)
 Starts a test runner.
#define XTESTS_START_RUNNER_WITH_STREAM(name, verbosity, stm)
 Starts a test runner.
#define XTESTS_START_RUNNER_WITH_REPORTER(name, verbosity, reporter, reporterParam)
 Starts a test runner with the given callback reporter.
#define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM(name, verbosity, reporter, reporterParam, stm)
 Starts a test runner with the given callback reporter.
#define XTESTS_START_RUNNER_WITH_REPORTER_AND_STREAM_AND_FLAGS(name, verbosity, reporter, reporterParam, stm, flags)
 Starts a test runner with the given callback reporter.
#define XTESTS_START_RUNNER_WITH_FLAGS(name, verbosity, flags)
 Starts a test runner with the given callback reporter.
#define XTESTS_PRINT_RESULTS()
 Prints the test results of the currently executing test.
#define XTESTS_END_RUNNER()
 Ends a test runner.
#define XTESTS_ABEND(terminationMessage)
 Abnormal end of tests, and process termination.
#define XTESTS_END_RUNNER_UPDATE_EXITCODE(retCode)
 Ends a test runner, and modifies a caller-supplied exit code parameter.
#define XTESTS_CASE_BEGIN(name, desc)
 Begins a test case, of the given name and description.
#define XTESTS_CASE_END(name)
 Ends the current test case.
#define XTESTS_RUN_CASE_WITH_NAME_AND_DESC(name, desc, fn)
 Runs the given test case function, specifying a name and description.
#define XTESTS_RUN_CASE_WITH_DESC(fn, desc)
 Runs the given test case function, specifying a description.
#define XTESTS_RUN_CASE(fn)
 Runs the given test case function.
#define XTESTS_RUN_CASE_THAT_THROWS_WITH_NAME_AND_DESC(name, desc, fn, type)
 Runs the given test case function, specifying a name and description, and the type of an exception that is expected.
#define XTESTS_RUN_CASE_THAT_THROWS_WITH_DESC(fn, desc, type)
 Runs the given test case function, specifying a description, and the type of an exception that is expected.
#define XTESTS_RUN_CASE_THAT_THROWS(fn, type)
 Runs the given test case function, specifying the type of an exception that is expected.
#define XTESTS_TEST_FAIL_WITH_QUALIFIER(msg, qualifier)
 Causes a test failure to be expressed, passing an explanatory message and a message qualifier.
#define XTESTS_TEST_FAIL(msg)
 Causes a test failure to be expressed, passing an explanatory message.
#define XTESTS_TEST_PASSED()
 Causes a test success to be expressed.
#define XTESTS_TEST_WITH_MESSAGE(expr, msg)
 Causes a test to be exercised, passing an explanatory message to be used in the case of failure.
#define XTESTS_TEST(expr)
 Causes a test to be exercised.
#define XTESTS_TEST_ENUM_EQUAL(expected, actual)   XTESTS_TEST_INTEGER_EQUAL_EXACT(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
 Tests that two enumerator values are exactly equal.
#define XTESTS_TEST_ENUM_NOT_EQUAL(expected, actual)   XTESTS_TEST_INTEGER_NOT_EQUAL(stlsoft_static_cast(int, (expected)), stlsoft_static_cast(int, (actual)))
 Tests that two enumerator values are not equal.
#define XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)
 Tests that two integer values are exactly equal.
#define XTESTS_TEST_INTEGER_NOT_EQUAL(expected, actual)
 Tests that two integer values are not equal.
#define XTESTS_TEST_INTEGER_GREATER(expected, actual)
 Tests that the actual integer value is greater than the expected value.
#define XTESTS_TEST_INTEGER_LESS(expected, actual)
 Tests that the actual integer value is less than the expected value.
#define XTESTS_TEST_INTEGER_GREATER_OR_EQUAL(expected, actual)
 Tests that the actual integer value is greater than or equal to the expected value.
#define XTESTS_TEST_INTEGER_LESS_OR_EQUAL(expected, actual)
 Tests that the actual integer value is less than or equal to the expected value.
#define XTESTS_TEST_BOOLEAN_EQUAL(expected, actual)
 Tests that two boolean values are exactly equal.
#define XTESTS_TEST_BOOLEAN_NOT_EQUAL(expected, actual)
 Tests that two boolean values are not equal.
#define XTESTS_TEST_BOOLEAN_TRUE(actual)
 Tests that an expression is true.
#define XTESTS_TEST_BOOLEAN_FALSE(actual)
 Tests that an expression is false.
#define XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)
 Tests that two character values are exactly equal.
#define XTESTS_TEST_CHARACTER_NOT_EQUAL(expected, actual)
 Tests that two character values are not equal.
#define XTESTS_TEST_CHARACTER_GREATER(expected, actual)
 Tests that the actual character value is greater than the expected value.
#define XTESTS_TEST_CHARACTER_LESS(expected, actual)
 Tests that the actual character value is less than the expected value.
#define XTESTS_TEST_CHARACTER_GREATER_OR_EQUAL(expected, actual)
 Tests that the actual character value is greater than or equal to the expected value.
#define XTESTS_TEST_CHARACTER_LESS_OR_EQUAL(expected, actual)
 Tests that the actual character value is less than or equal to the expected value.
#define XTESTS_TEST_FLOATINGPOINT_EQUAL_EXACT(expected, actual)
 Tests that two floating point values are exactly equal.
#define XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)
 Tests that two floating point values are approximately equal (as defined by XTESTS_FP_APPROXIMATE_FACTOR).
#define XTESTS_TEST_INTEGER_EQUAL(expected, actual)   XTESTS_TEST_INTEGER_EQUAL_EXACT(expected, actual)
 Tests that two integer values (of the same type) are equal.
#define XTESTS_TEST_FLOATINGPOINT_EQUAL(expected, actual)   XTESTS_TEST_FLOATINGPOINT_EQUAL_APPROX(expected, actual)
 Tests that two floating point values (of the same type) are equal.
#define XTESTS_TEST_CHARACTER_EQUAL(expected, actual)   XTESTS_TEST_CHARACTER_EQUAL_EXACT(expected, actual)
 Tests that two character values (of the same type) are equal.
#define XTESTS_TEST_MULTIBYTE_STRING_EQUAL(expected, actual)
 Tests that two (multibyte) strings are equal.
#define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_APPROX(expected, actual)
 Tests that two (multibyte) strings are approximately equal (by ignoring case).
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL(expected, actual)
 Tests that two (multibyte) strings are not equal.
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_APPROX(expected, actual)
 Tests that two (multibyte) strings are not equal (when ignoring case).
#define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N(expected, actual, n)
 Tests that two (multibyte) strings are equal up to a given limit.
#define XTESTS_TEST_MULTIBYTE_STRING_EQUAL_N_APPROX(expected, actual, n)
 Tests that two (multibyte) strings are approximately equal (by ignoring case), up to a given limit.
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N(expected, actual, n)
 Tests that two (multibyte) strings are not equal.
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n)
 Tests that two (multibyte) strings are not equal (when ignoring case).
#define XTESTS_TEST_WIDE_STRING_EQUAL(expected, actual)
 Tests that two (wide) strings are equal.
#define XTESTS_TEST_WIDE_STRING_EQUAL_APPROX(expected, actual)
 Tests that two (wide) strings are approximately equal (by ignoring case).
#define XTESTS_TEST_WIDE_STRING_NOT_EQUAL(expected, actual)
 Tests that two (wide) strings are not equal.
#define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_APPROX(expected, actual)
 Tests that two (wide) strings are not equal (when ignoring case).
#define XTESTS_TEST_WIDE_STRING_EQUAL_N(expected, actual, n)
 Tests that two (wide) strings are equal up to a given limit.
#define XTESTS_TEST_WIDE_STRING_EQUAL_N_APPROX(expected, actual, n)
 Tests that two (wide) strings are approximately equal (by ignoring case), up to a given limit.
#define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N(expected, actual, n)
 Tests that two (wide) strings are not equal.
#define XTESTS_TEST_WIDE_STRING_NOT_EQUAL_N_APPROX(expected, actual, n)
 Tests that two (wide) strings are not equal (when ignoring case).
#define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN(expected, actual)
 Tests that the string contains the expected sub-sequence.
#define XTESTS_TEST_MULTIBYTE_STRING_CONTAIN_APPROX(expected, actual)
 Tests that the string contains the expected sub-sequence (disregarding case).
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN(expected, actual)
 Tests that the string does not contain the expected sub-sequence.
#define XTESTS_TEST_MULTIBYTE_STRING_NOT_CONTAIN_APPROX(expected, actual)
 Tests that the string does not contain the expected sub-sequence (disregarding case).
#define XTESTS_TEST_WIDE_STRING_CONTAIN(expected, actual)
 Tests that the string contains the expected sub-sequence.
#define XTESTS_TEST_WIDE_STRING_CONTAIN_APPROX(expected, actual)
 Tests that the string contains the expected sub-sequence (disregarding case).
#define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN(expected, actual)
 Tests that the string does not contain the expected sub-sequence.
#define XTESTS_TEST_WIDE_STRING_NOT_CONTAIN_APPROX(expected, actual)
 Tests that the string does not contain the expected sub-sequence.
#define XTESTS_TEST_POINTER_EQUAL(expected, actual)
 Tests that two pointers are equal.
#define XTESTS_TEST_POINTER_NOT_EQUAL(expected, actual)
 Tests that two pointer values are not equal.
#define XTESTS_TEST_POINTER_GREATER(expected, actual)
 Tests that the actual pointer value is greater than the expected value.
#define XTESTS_TEST_POINTER_LESS(expected, actual)
 Tests that the actual pointer value is less than the expected value.
#define XTESTS_TEST_POINTER_GREATER_OR_EQUAL(expected, actual)
 Tests that the actual pointer value is greater than or equal to the expected value.
#define XTESTS_TEST_POINTER_LESS_OR_EQUAL(expected, actual)
 Tests that the actual pointer value is less than or equal to the expected value.
#define XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, pverbosity)
 Parses a verbosity from the command-line.

Enumerations

enum  xtests_runner_flags_t {
  xtestsRunnerFlagsNoWindowsDebugString = 0x0001,
  xtestsReportOnlyNonEmptyCases = 0x0002
}
 Flags to be passed to xtests_startRunner. More...
enum  xtests_verbosity_t {
  xtestsVerbositySilent = 0,
  xtestsVerbositySummaryOnError = 1,
  xtestsVerbosityVerboseOnError = 2,
  xtestsVerbositySummaryOnSuccess = 3,
  xtestsVerbosityVerboseOnSuccess = 4
}
 The verbosity level to be applied when executing a test runner. More...


Define Documentation

#define _XTESTS_VER   0x000a03ff

The composite version of the xTests library.

#define _XTESTS_VER_MAJOR   0

The Major version number of the xTests library.

#define _XTESTS_VER_MINOR   10

Minor version number of the xTests library.

#define _XTESTS_VER_REVISION   3

The revision number of the xTests library.

#define XTESTS_FP_APPROXIMATE_FACTOR   (1.000001)

The factor within which floating point numbers are deemed to be approximately equal.


xTests Library documentation © Matthew Wilson and Synesis Software Pty Ltd, 1999-2009 SourceForge.net Logo