|
Awkl
|
Functions | |
| unassigned | import () |
Import functions as strings in the awk namespace. | |
| unassigned | add (string|array< string > names) |
| Add tests' names to be run. | |
| unassigned | printSummary () |
| Print the tests summary. | |
| bool | testOne (string tname) |
| Run a single test in a test set. | |
| auto | runTests (string|array< string > names, number exit_f=0, number import_f=1) -> bool|never |
| Run a set of tests. | |
| unassigned | it (string d) |
| Set a description for the current test. | |
| unassigned | _assert (any x, string msg_ok, string msg_bad) |
| Underlying assert function. | |
| unassigned | assertTruthy (any x) |
| Assert whether a variable is truthy. | |
| unassigned | assertFalsy (any x) |
| Assert whether a variable is falsy. | |
| unassigned | assertTrue (any x) |
Assert whether a variable is true (number|bool 1) | |
| unassigned | assertFalse (any x) |
Assert whether a variable is true (number|bool 0) | |
| unassigned | assert (any x) |
Alias for test::assertTruthy | |
| unassigned | assertOp (any x, any e, string op, string sym, string pre, string post) |
| Assert whether a binary operation on two variables is truthy. | |
| unassigned | assertOpTrue (any x, any e, string op, string sym) |
| Assert whether a binary operation on two variables is truthful. | |
| unassigned | assertEq (scalar x, scalar e) |
| Assert whether a variable is equal to another. | |
| unassigned | assertEq (array X, array E) |
| Assert whether all elements in an array are equal to the ones in another. | |
| unassigned | assertNe (scalar x, scalar e) |
| Assert whether a variable is not equal to another. | |
| unassigned | assertNe (array X, array E) |
| Assert whether all elements in an array are not equal to the ones in another. | |
| unassigned | assertLt (scalar x, scalar e) |
| Assert whether a variable is less than another. | |
| unassigned | assertLt (array X, array E) |
| Assert whether all elements in an array are less than the ones in another. | |
| unassigned | assertLe (scalar x, scalar e) |
| Assert whether a variable is less than or equal another. | |
| unassigned | assertLe (array X, array E) |
| Assert whether all elements in an array are less than or equal to the ones in another. | |
| unassigned | assertGt (scalar x, scalar e) |
| Assert whether a variable is greater than another. | |
| unassigned | assertGt (array X, array E) |
| Assert whether all elements in an array are greater than the ones in another. | |
| unassigned | assertGe (scalar x, scalar e) |
| Assert whether a variable is greater than or equal another. | |
| unassigned | assertGe (array X, array E) |
| Assert whether all elements in an array are greater than or equal to the ones in another. | |
| unassigned | assertMatch (scalar x, scalar e) |
| Assert whether a variable matches a regular expression. | |
| unassigned | assertMatch (array X, array E) |
| Assert whether all elements in an array match a regular expression. | |
| unassigned | assertNomatch (scalar x, scalar e) |
| Assert whether a variable does not match a regular expression. | |
| unassigned | assertNomatch (array X, array E) |
| Assert whether all elements in an array do not match a regular expression. | |
| unassigned | assertApprox (number x, number e, numeric rt=0.01, numeric at=0.00) |
| Assert whether a variable is approximately equal to another. | |
| unassigned | assertApprox (array X, array E, numeric rt=0.01, numeric at=0.00) |
| Assert whether all elements in an array are approximately equal to the ones in another. | |
| unassigned | assertInside (any x, array A) |
| Assert whether a variable is an element of an array. | |
| unassigned | assertContains (array A, any x) |
| Assert whether an array contains an element. | |
| unassigned | assertSetInside (scalar x, set A) |
| Assert whether a variable is an element of a set. | |
| unassigned | assertSetInside (set A, set B) |
| Assert whether a set is a (non-strict) subset of another. | |
| unassigned | assertSetContains (set A, scalar x) |
| Assert whether a set contains an element. | |
| unassigned | assertSetContains (set A, set B) |
| Assert whether a set is a (non-strict) superset of another. | |
| unassigned | assertType (any x, string type) |
| Assert whether variable is of a specific type. | |
Variables | |
| number | conf ["assertion"]["print"] = 0 |
| unassigned test::_assert | ( | any | x, |
| string | msg_ok, | ||
| string | msg_bad ) |
Underlying assert function.
| x | Value to check for its truthyness |
| msg_ok | Text for showing on a successful assertion |
| msg_bad | Text for showing on a failed assertion |
| unassigned test::add | ( | string|array< string > | names | ) |
Add tests' names to be run.
| names | Tests' names to add, without their test_ prefix |
| unassigned test::assert | ( | any | x | ) |
| unassigned test::assertApprox | ( | array | X, |
| array | E, | ||
| numeric | rt = 0.01, | ||
| numeric | at = 0.00 ) |
Assert whether all elements in an array are approximately equal to the ones in another.
| X | Array of variables to check |
| E | Array of expected approximate values |
| rt | Relative tolerance |
| at | Absolute tolerance |
| unassigned test::assertApprox | ( | number | x, |
| number | e, | ||
| numeric | rt = 0.01, | ||
| numeric | at = 0.00 ) |
Assert whether a variable is approximately equal to another.
| x | Variable to check |
| e | Expected approximate value |
| rt | Relative tolerance |
| at | Absolute tolerance |
| unassigned test::assertContains | ( | array | A, |
| any | x ) |
Assert whether an array contains an element.
| A | Containing array |
| x | Value to check its inclusion |
| unassigned test::assertEq | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are equal to the ones in another.
| X | Array of variables to check |
| E | Array of expected values |
| unassigned test::assertEq | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is equal to another.
| x | Variable to check |
| e | Expected value |
| unassigned test::assertFalse | ( | any | x | ) |
Assert whether a variable is true (number|bool 0)
| x | Variable to check for its falseness |
| unassigned test::assertFalsy | ( | any | x | ) |
Assert whether a variable is falsy.
| x | Variable to check for its falsyness |
| unassigned test::assertGe | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are greater than or equal to the ones in another.
| X | Left array |
| E | Right array |
| unassigned test::assertGe | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is greater than or equal another.
| x | Left operand |
| e | Right operand |
| unassigned test::assertGt | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are greater than the ones in another.
| X | Left array |
| E | Right array |
| unassigned test::assertGt | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is greater than another.
| x | Left operand |
| e | Right operand |
| unassigned test::assertInside | ( | any | x, |
| array | A ) |
Assert whether a variable is an element of an array.
| x | Variable to check its inclusion |
| A | Containing array |
| unassigned test::assertLe | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are less than or equal to the ones in another.
| X | Left array |
| E | Right array |
| unassigned test::assertLe | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is less than or equal another.
| x | Left operand |
| e | Right operand |
| unassigned test::assertLt | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are less than the ones in another.
| X | Left array |
| E | Right array |
| unassigned test::assertLt | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is less than another.
| x | Left operand |
| e | Right operand |
| unassigned test::assertMatch | ( | array | X, |
| array | E ) |
Assert whether all elements in an array match a regular expression.
| X | Array of variables to check |
| E | Array of regular expressions to match against |
| unassigned test::assertMatch | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable matches a regular expression.
| x | Variable to check |
| e | Regular expression to match against |
| unassigned test::assertNe | ( | array | X, |
| array | E ) |
Assert whether all elements in an array are not equal to the ones in another.
| X | Left array |
| E | Right array |
| unassigned test::assertNe | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable is not equal to another.
| x | Left operand |
| e | Right operand |
| unassigned test::assertNomatch | ( | array | X, |
| array | E ) |
Assert whether all elements in an array do not match a regular expression.
| X | Array of variables to check |
| E | Array of regular expressions to match against |
| unassigned test::assertNomatch | ( | scalar | x, |
| scalar | e ) |
Assert whether a variable does not match a regular expression.
| x | Variable to check |
| e | Regular expression to match against |
| unassigned test::assertOp | ( | any | x, |
| any | e, | ||
| string | op, | ||
| string | sym, | ||
| string | pre, | ||
| string | post ) |
Assert whether a binary operation on two variables is truthy.
| x | Left operand |
| e | Right operand |
| op | Operation: a function name |
| sym | Symbol denoting the operation |
| pre | |
| post |
| unassigned test::assertOpTrue | ( | any | x, |
| any | e, | ||
| string | op, | ||
| string | sym ) |
Assert whether a binary operation on two variables is truthful.
| x | Left operand |
| e | Right operand |
| op | Operation: a function name |
| sym | Symbol denoting the operation |
| unassigned test::assertSetContains | ( | set | A, |
| scalar | x ) |
Assert whether a set contains an element.
| A | Containing set |
| x | Variable to check its inclusion |
| unassigned test::assertSetContains | ( | set | A, |
| set | B ) |
Assert whether a set is a (non-strict) superset of another.
| A | Containing set |
| B | Set to check for its inclusion |
| unassigned test::assertSetInside | ( | scalar | x, |
| set | A ) |
Assert whether a variable is an element of a set.
| x | Variable to check for its inclusion |
| A | Containing set |
| unassigned test::assertSetInside | ( | set | A, |
| set | B ) |
Assert whether a set is a (non-strict) subset of another.
| A | Set to check for its inclusion |
| B | Containing set |
| unassigned test::assertTrue | ( | any | x | ) |
Assert whether a variable is true (number|bool 1)
| x | Variable to check for its truthfulness |
| unassigned test::assertTruthy | ( | any | x | ) |
Assert whether a variable is truthy.
| x | Variable to check for its truthyness |
| unassigned test::assertType | ( | any | x, |
| string | type ) |
Assert whether variable is of a specific type.
| x | Variable to check its type |
| type | Type name |
| unassigned test::import | ( | ) |
Import functions as strings in the awk namespace.
| unassigned test::it | ( | string | d | ) |
Set a description for the current test.
| d | Description text for the current test |
| unassigned test::printSummary | ( | ) |
Print the tests summary.
| auto test::runTests | ( | string|array< string > | names, |
| number | exit_f = 0, | ||
| number | import_f = 1 ) -> bool | never |
Run a set of tests.
| names | Names of tests to be run. Optional. If ommited, functions starting with test_ are considered |
| exit_f | Whether to exit at the end of testing |
| import_f | Whether to automatically import functions to the awk namespace |
| bool test::testOne | ( | string | tname | ) |
Run a single test in a test set.
| tname | Full name of the current test function |
| string test::conf = 0 |