Loading...
Searching...
No Matches
QUnit::Test Class Reference

Base class representing a simple test, implements an implicit main() function and all utility functions for testing. More...

Inheritance diagram for QUnit::Test:
[legend]

## Public Member Functions

| addTestCase (QUnit::TestCase tc)
| adds a test case to run
| addTestCase (string name, code call, *softlist< auto > args)
| adds a test case to run
| assertEq (auto expected, auto actual, *string name)
| Tests a value for equality to an expected value with hard comparisons (types and values must be identical)
| assertEqSoft (auto expected, auto actual, *string name)
| Tests a value for equality to an expected value with soft comparisons (types may differ)
| assertFalse (auto actual, *string name)
| Tests a boolean value.
| assertFloatEq (float expected, float actual, float epsilon=DEFAULT_EPSILON, *string name)
| Tests a float value for equality to an expected value with an allowed error.
| assertGe (auto expected, auto actual, *string name)
| Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ)
| assertGeSoft (auto expected, auto actual, *string name)
| Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ)
| assertGt (auto expected, auto actual, *string name)
| Tests that a value is greater than an expected value with hard comparisons (types may not differ)
| assertGtSoft (auto expected, auto actual, *string name)
| Tests that a value is greater than an expected value with soft comparisons (types may differ)
| assertionOk (*string name)
| process an ok assertion
| assertLe (auto expected, auto actual, *string name)
| Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ)
| assertLeSoft (auto expected, auto actual, *string name)
| Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ)
| assertLt (auto expected, auto actual, *string name)
| Tests that a value is less than an expected value with hard comparisons (types may not differ)
| assertLtSoft (auto expected, auto actual, *string name)
| Tests that a value is less than an expected value with soft comparisons (types may differ)
| assertNeq (auto expected, auto actual, *string name)
| Tests a value for inequality to an expected value with hard comparisons (types and values must be identical)
| assertNeqSoft (auto expected, auto actual, *string name)
| Tests a value for inequality to an expected value with soft comparisons (types may differ)
| assertNothing (auto actual, *string name)
| Tests for no value.
| assertNRegex (string regex_pattern, string actual, *string name)
| Tests that a test value does not pass a regular expression match.
| assertNumberEq (number expected, number actual, number epsilon=DEFAULT_EPSILON, *string name)
| Tests a number value for equality to an expected value with an allowed error.
| assertRegex (string regex_pattern, string actual, *string name)
| Tests that a test value passes a regular expression match.
| assertSkip (*string name)
| Skips assertion on purpose.
public | assertThrows (string expectedErr, *string expectedDesc, *hash< auto > arg, code theCode, *softlist< auto > args, *string name)
| Tests that a piece of code throws an exception with given description and exception arg keys.
| assertThrows (string expectedErr, *string expectedDesc, code theCode, *softlist< auto > args, *string name)
| Tests that a piece of code throws an exception with given description.
| assertThrows (string expectedErr, code theCode, *softlist< auto > args, *string name)
| Tests that a piece of code throws an exception.
| assertTrue (auto actual, *string name)
| Tests a boolean value.
| constructor (string name, string version, *list< auto > p_argv, *hash< auto > opts)
| creates the object and sets the name of the test
| constructor (string name, string version, reference< list< string > > p_argv, *hash< auto > opts)
| creates the object and sets the name of the test
bool | equals (auto a, auto b)
| Compare two values for equality.
bool | equalsIterated (AbstractIterator a, AbstractIterator b)
| Compare two iterables, item by item, for equality of each index.
| fail (*string msg)
| Fails the test unconditionally.
*string | getEnv (string key, *string def)
| facade for the system environment variables
TestCase | getTestCase (string meth)
| returns the current test case
| globalSetUp ()
| global setup; will be called once before tests are run
| globalTearDown ()
| global tear down; will be called once after all tests are run
int | main ()
| Run the whole suite, report results.
bool | notEquals (auto a, auto b)
| Compare two values for inequality.
string | printUnexpectedData (auto exp, auto act, *bool neg, *bool soft_comparisons, *string comparitor)
| Helper function for printing out human-readable comparison of two values.
bool | regexpMatches (string s, string regexp)
| Compare a string for match against a regexp.
| setUp ()
| Prototype function for setting up test environment. It will be called for each test individually.
| tearDown ()
| Prototype function for cleaning up test environemnt. It will be called after each test has executed.
auto | testAssertion (string name, code condition, *softlist< auto > args, binary expectedResultValue)
| Tests for a single assertion for a call returning a binary value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, bool expectedResultValue)
| Tests for a single assertion for a call returning a boolean value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, date expectedResultValue)
| Tests for a single assertion for a call returning a date value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, float expectedResultValue)
| Tests for a single assertion for a call returning a floating-point value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, hash< auto > expectedResultValue)
| Tests for a single assertion for a call returning a hash value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, int expectedResultValue)
| Tests for a single assertion for a call returning an integer value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, list< auto > expectedResultValue)
| Tests for a single assertion for a call returning a list value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, number expectedResultValue)
| Tests for a single assertion for a call returning an arbitrary-precision numeric value and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, QUnit::AbstractTestResult expectedResult=new QUnit::TestResultSuccess())
| Tests for a single assertion and returns the value generated.
auto | testAssertion (string name, code condition, *softlist< auto > args, string expectedResultValue)
| Tests for a single assertion for a call returning a string value and returns the value generated.
auto | testAssertionValue (*string name, auto actual, auto expected)
| Tests a value for equality to an expected value.
auto | testAssertionValue (*string name, float actual, float expected, float epsilon=DEFAULT_EPSILON)
| Tests a value for equality to an expected value of float type.
auto | testAssertionValue (*string name, number actual, number expected, number epsilon=DEFAULT_EPSILON)
| Tests a value for equality to an expected value of number type.
| testNullAssertion (string name, code condition, *softlist< auto > args)
| Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception)
| testSkip (string reason)
| Skips a given test, eg. because it may be missing some dependencies.
Public Member Functions inherited from QUnit::TestReporter
| constructor (string name, string version, *list< auto > p_argv, hash< auto > opts=Opts)
| creates the object from the arguments
| constructor (string name, string version, reference< list< string > > p_argv, hash< auto > opts=Opts)
| creates the object from the arguments

## Static Public Member Functions

static bool | comparePartialHash (hash< auto > expects, auto value)
| Returns True if the keys given in the first hash match those in the second hash.
static string | getAssertionName (*string name)
| returns the assertion name for display purposes

## Protected Member Functions

list< TestCase > | testCases ()
| list of test cases
Protected Member Functions inherited from QUnit::TestReporter
| addTestResult (TestCase tc, int success, *string error, *string pos, *string detail)
| adds a test result
int | errors ()
| returns the number of errors encountered during test execution
| init (string name, string version, reference< list< string > > p_argv, hash< auto > opts=Opts)
| common constructor code
int | skipped ()
| returns the number of tests skipped
int | testCount ()
| returns the total number of test results

## Private Attributes

const | DEFAULT_EPSILON = 0.0000000001
| default epsilon for number/float comparison
const | QUC_EQ = "eq"
| equality comparitor
const | QUC_GE = "ge"
| greater than or equals comparitor
const | QUC_GT = "gt"
| greater than comparitor
const | QUC_LE = "le"
| greater than or equals comparitor
const | QUC_LT = "lt"
| greater than comparitor
const | QUC_Map = ...
| comparitor info
const | QUC_NEQ = "neq"
| inequality comparitor
const | QUC_NRE = "nre"
| negative regex comparitor
const | QUC_RE = "re"
| regex comparitor

## Additional Inherited Members

Public Attributes inherited from QUnit::TestReporter
const | Opts = ...
| default options for Qore::GetOpt::constructor()
Protected Attributes inherited from QUnit::TestReporter
string | m_name
| test case name
hash< auto > | m_options
| the result of parsing command-line options with Qore::GetOpt::parse2()
hash< string, hash< string, code > > | m_printMethods
| A map of print methods, categorised into three types: header, summary, testreport.
string | m_version
| test case version
*list< auto > | new_argv
| new ARGV for languages that don't support lvalue references
int | num_asserts = 0
| total number of assertions in script
int | num_asserts_ok = 0
| total number of successful assertions in script
int | num_asserts_skip = 0
| total number of skipped assertions in script
const | OffsetColumn = 20
| the default column offset for printing options used in printOption() and usageIntern()

## Detailed Description

Base class representing a simple test, implements an implicit main() function and all utility functions for testing.

## Member Function Documentation

## addTestCase() [1/2]

QUnit::Test::addTestCase | ( | QUnit::TestCase | tc | ) |

adds a test case to run

Example:
  addTestCase(obj);

Parameters

  tc | the test case object

## addTestCase() [2/2]

QUnit::Test::addTestCase | ( | string | name,
|  | code | call,
|  | *softlist< auto > | args
| ) |  |

adds a test case to run

Example:
  addTestCase("MyTest", \myTest());

Parameters

  name | the name of the test case
  call | the code to call that executes the test case
  args | any optional arguments to the test case call

## assertEq()

QUnit::Test::assertEq | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests a value for equality to an expected value with hard comparisons (types and values must be identical)

Example:
  assertEq(5, function_that_should_return_five());

Parameters

  expected | the expected value
  actual | the value generated by the test
  name | the name or description of the assertion

## assertEqSoft()

QUnit::Test::assertEqSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests a value for equality to an expected value with soft comparisons (types may differ)

Example:
  assertEqSoft("5", function_that_should_return_five());

Parameters

  expected | the expected value
  actual | the value generated by the test
  name | the name or description of the assertion

## assertFalse()

QUnit::Test::assertFalse | ( | auto | actual,
|  | *string | name
| ) |  |

Tests a boolean value.

Example:
  assertFalse(functionThatShouldReturnFalse());

Parameters

  actual | the value generated by the test
  name | the name or description of the assertion

## assertFloatEq()

QUnit::Test::assertFloatEq | ( | float | expected,
|  | float | actual,
|  | float | epsilon = `DEFAULT_EPSILON`,
|  | *string | name
| ) |  |

Tests a float value for equality to an expected value with an allowed error.

Example:
  assertFloatEq(2.5, 2.50001, 0.001);

Parameters

  expected | the expected value
  actual | the value generated by the test
  epsilon | the allowed error
  name | the name or description of the assertion

## assertGe()

QUnit::Test::assertGe | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is greater than or equal to an expected value with hard comparisons (types may not differ)

Example:
  assertGe(5, function_that_should_rturn_a_value_greater_than_or_equal_to_five());

Parameters

  expected | a value that should be less than or equal to actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertGeSoft()

QUnit::Test::assertGeSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is greater than or equal to than an expected value with soft comparisons (types may differ)

Example:
  assertGeSoft("5", function_that_should_rturn_a_value_greater_than_or_equal_to_five());

Parameters

  expected | a value that should be less than or equal to actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertGt()

QUnit::Test::assertGt | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is greater than an expected value with hard comparisons (types may not differ)

Example:
  assertGt(5, function_that_should_rturn_a_value_greater_than_five());

Parameters

  expected | a value that should be less than actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertGtSoft()

QUnit::Test::assertGtSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is greater than an expected value with soft comparisons (types may differ)

Example:
  assertGtSoft("5", function_that_should_rturn_a_value_greater_than_five());

Parameters

  expected | a value that should be less than actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertLe()

QUnit::Test::assertLe | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is less than or equal to an expected value with hard comparisons (types may not differ)

Example:
  assertLe(5, function_that_should_rturn_a_value_less_than_or_equal_to_five());

Parameters

  expected | a value that should be greater than or equal to actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertLeSoft()

QUnit::Test::assertLeSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is less than or equal to than an expected value with soft comparisons (types may differ)

Example:
  assertLeSoft("5", function_that_should_rturn_a_value_less_than_or_equal_to_five());

Parameters

  expected | a value that should be greater than or equal to actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertLt()

QUnit::Test::assertLt | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is less than an expected value with hard comparisons (types may not differ)

Example:
  assertLt(5, function_that_should_rturn_a_value_less_than_five());

Parameters

  expected | a value that should be greater than actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertLtSoft()

QUnit::Test::assertLtSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests that a value is less than an expected value with soft comparisons (types may differ)

Example:
  assertLtSoft("5", function_that_should_rturn_a_value_less_than_five());

Parameters

  expected | a value that should be greater than actual
  actual | the value generated by the test
  name | the name or description of the assertion

## assertNeq()

QUnit::Test::assertNeq | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests a value for inequality to an expected value with hard comparisons (types and values must be identical)

Example:
  assertNeq(5, function_that_should_return_five());

Parameters

  expected | the value that should not be equal to the test value with a hard comparison
  actual | the value generated by the test
  name | the name or description of the assertion

## assertNeqSoft()

QUnit::Test::assertNeqSoft | ( | auto | expected,
|  | auto | actual,
|  | *string | name
| ) |  |

Tests a value for inequality to an expected value with soft comparisons (types may differ)

Example:
  assertNeqSoft("5", function_that_should_not_return_five());

Parameters

  expected | the value that should not be equal to the test value with a soft comparison
  actual | the value generated by the test
  name | the name or description of the assertion

## assertNothing()

QUnit::Test::assertNothing | ( | auto | actual,
|  | *string | name
| ) |  |

Tests for no value.

Example:
  assertNothing(function_that_should_not_return_a value());

Parameters

  actual | the value generated by the test
  name | the name or description of the assertion

## assertNRegex()

QUnit::Test::assertNRegex | ( | string | regex_pattern,
|  | string | actual,
|  | *string | name
| ) |  |

Tests that a test value does not pass a regular expression match.

Example:
  assertNRegex("regex string", string_function());

Parameters

  regex_pattern | the regular expression pattern string that the test value should not match
  actual | the value generated by the test
  name | the name or description of the assertion

## assertNumberEq()

QUnit::Test::assertNumberEq | ( | number | expected,
|  | number | actual,
|  | number | epsilon = `DEFAULT_EPSILON`,
|  | *string | name
| ) |  |

Tests a number value for equality to an expected value with an allowed error.

Example:
  assertNumberEq(2.5n, 2.50001n, 0.001n);

Parameters

  expected | the expected value
  actual | the value generated by the test
  epsilon | the allowed error
  name | the name or description of the assertion

## assertRegex()

QUnit::Test::assertRegex | ( | string | regex_pattern,
|  | string | actual,
|  | *string | name
| ) |  |

Tests that a test value passes a regular expression match.

Example:
  assertRegex("regex string", string_function());

Parameters

  regex_pattern | the regular expression pattern string that the test value should match
  actual | the value generated by the test
  name | the name or description of the assertion

## assertSkip()

QUnit::Test::assertSkip | ( | *string | name | ) |

Skips assertion on purpose.

Parameters

  name | the name or description of the assertion

Example:
  assertSkip("assertion name or reason to skip");

## assertThrows() [1/3]

public QUnit::Test::assertThrows | ( | string | expectedErr,
|  | *string | expectedDesc,
|  | *hash< auto > | arg,
|  | code | theCode,
|  | *softlist< auto > | args,
|  | *string | name
| ) |  |

inline

Tests that a piece of code throws an exception with given description and exception arg keys.

Example:
  assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);

Parameters

  expectedErr | the expected exception type
  expectedDesc | the expected exception detail as a regex pattern (desc field); ignored if NOTHING
  expectedArg | the expected keys in the exception `arg` hash; ignored if NOTHING
  theCode | the code to execute
  args | optional arguments to the code
  name | an optional label for the assertion

## assertThrows() [2/3]

QUnit::Test::assertThrows | ( | string | expectedErr,
|  | *string | expectedDesc,
|  | code | theCode,
|  | *softlist< auto > | args,
|  | *string | name
| ) |  |

Tests that a piece of code throws an exception with given description.

Example:
  assertThrows("DIVISION-BY-ZERO", "division by zero found in integer expression", sub(int a) {print(5/a);}, 0);

Parameters

  expectedErr | the expected exception type
  expectedDesc | the expected exception detail as a regex pattern (desc field); ignored if NOTHING
  theCode | the code to execute
  args | optional arguments to the code
  name | an optional label for the assertion

## assertThrows() [3/3]

QUnit::Test::assertThrows | ( | string | expectedErr,
|  | code | theCode,
|  | *softlist< auto > | args,
|  | *string | name
| ) |  |

Tests that a piece of code throws an exception.

Example:
  assertThrows("DIVISION-BY-ZERO", sub(int a) {print(5/a);}, 0);

Parameters

  expectedErr | the expected exception type
  theCode | the code to execute
  args | optional arguments to the code
  name | an optional label for the assertion

## assertTrue()

QUnit::Test::assertTrue | ( | auto | actual,
|  | *string | name
| ) |  |

Tests a boolean value.

Example:
  assertTrue(functionThatShouldReturnTrue());

Parameters

  actual | the value generated by the test
  name | the name or description of the assertion

## equals()

bool QUnit::Test::equals | ( | auto | a,
|  | auto | b
| ) |  |

Compare two values for equality.

Parameters

  a | Argument 1
  b | Argument 2

Returns
  a == b

## equalsIterated()

bool QUnit::Test::equalsIterated | ( | AbstractIterator | a,
|  | AbstractIterator | b
| ) |  |

Compare two iterables, item by item, for equality of each index.

Parameters

  a | Iterable 1
  b | Iterable 2

Returns
  a == b

## fail()

QUnit::Test::fail | ( | *string | msg | ) |

Fails the test unconditionally.

Example:
  fail("Unexpected code executed");

Parameters

  msg | the failure message

## notEquals()

bool QUnit::Test::notEquals | ( | auto | a,
|  | auto | b
| ) |  |

Compare two values for inequality.

Parameters

  a | Argument 1
  b | Argument 2

Returns
  a != b

## regexpMatches()

bool QUnit::Test::regexpMatches | ( | string | s,
|  | string | regexp
| ) |  |

Compare a string for match against a regexp.

Parameters

  s | String to match
  regexp | Regular expression to match against

Returns
  a == b

## testAssertion() [1/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | binary | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a binary value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a binary value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [2/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | bool | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a boolean value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a boolean value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [3/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | date | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a date value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a date value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [4/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | float | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a floating-point value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a floating-point value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [5/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | hash< auto > | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a hash value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a hash value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [6/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | int | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning an integer value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | an integer value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [7/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | list< auto > | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a list value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a list value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [8/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | number | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning an arbitrary-precision numeric value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | an arbitrary-precision numeric value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [9/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | QUnit::AbstractTestResult | expectedResult = `new QUnit::TestResultSuccess()`
| ) |  |

Tests for a single assertion and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResult | A class describing the expected result of condition; the default is QUnit::TestResultSuccess

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertion() [10/10]

auto QUnit::Test::testAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args,
|  | string | expectedResultValue
| ) |  |

Tests for a single assertion for a call returning a string value and returns the value generated.

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition
  expectedResultValue | a string value

Returns
  the result of the condition call, if the immediate value has any further use

## testAssertionValue() [1/3]

auto QUnit::Test::testAssertionValue | ( | *string | name,
|  | auto | actual,
|  | auto | expected
| ) |  |

Tests a value for equality to an expected value.

Example:
  testAssertionValue("date > operator", now() > (now() - 1D), True);

Parameters

  name | the name or description of the assertion
  actual | the value generated by the test
  expected | the expected value

Returns
  the value argument

Note
  make sure and use testAssertion() for any calls that could throw an exception

## testAssertionValue() [2/3]

auto QUnit::Test::testAssertionValue | ( | *string | name,
|  | float | actual,
|  | float | expected,
|  | float | epsilon = `DEFAULT_EPSILON`
| ) |  |

Tests a value for equality to an expected value of float type.

Parameters

  name | the name or description of the assertion
  actual | the value generated by the test
  expected | the expected value
  epsilon | accepted difference

Returns
  the value argument

Note
  make sure and use testAssertion() for any calls that could throw an exception

## testAssertionValue() [3/3]

auto QUnit::Test::testAssertionValue | ( | *string | name,
|  | number | actual,
|  | number | expected,
|  | number | epsilon = `DEFAULT_EPSILON`
| ) |  |

Tests a value for equality to an expected value of number type.

Parameters

  name | the name or description of the assertion
  actual | the value generated by the test
  expected | the expected value
  epsilon | accepted difference

Returns
  the value argument

Note
  make sure and use testAssertion() for any calls that could throw an exception

## testNullAssertion()

QUnit::Test::testNullAssertion | ( | string | name,
|  | code | condition,
|  | *softlist< auto > | args
| ) |  |

Tests for a single assertion for a call returning no value (for example, to ensure that the call does not throw an exception)

Parameters

  name | the name or description of the assertion
  condition | A test function whose result we are asserting
  args | Arguments passed to condition

Returns
  the result of the condition call, if the immediate value has any further use

## testSkip()

QUnit::Test::testSkip | ( | string | reason | ) |

Skips a given test, eg. because it may be missing some dependencies.

Parameters

  reason | The reason for the test skip; used as the format argument with vsprintf() with any remaining arguments