Module pl.test

Useful test utilities.

Functions

asserteq (x, y) like assert, except takes two arguments that must be equal.
asserteq2 (x1, x2, y1, y2) a version of asserteq that takes two pairs of values.
timer (msg, n, fun, ...) Time a function.


Functions

asserteq (x, y)
like assert, except takes two arguments that must be equal. If they are plain tables, it will use tablex.deepcompare.

Parameters:

  • x: any value
  • y: a value equal to x
asserteq2 (x1, x2, y1, y2)
a version of asserteq that takes two pairs of values.

Parameters:

  • x1: any value
  • x2:
  • y1:
  • y2:
timer (msg, n, fun, ...)
Time a function. Call the function a given number of times, and report the number of seconds taken, together with a message. Any extra arguments will be passed to the function.

Parameters:

  • msg: a descriptive message
  • n: number of times to call the function
  • fun: the function
  • ...:

Valid XHTML 1.0!