SIMPOL Documentation

Chapter 96. unittest

This is a basic unit testing library. It can be used to crreate and run regression tests for functions with various cases.

testcase

Description

Type Tags

testcase

Object Value

Objects of type testcase have no value, and it is an error to try to get or set this value.

testcase.new()

Description

Prototype

testcase.new ( testcase me, string name, function test, type(*) testref )

Parameters

ParameterDefault valueType nameDescription
meNonetestcase
nameNonestring
testNonefunction
testrefNonetype(*)

Properties

PropertyTypeDescription
addvaluefunction
cleanupfunction
defaultTestResultfunction
descriptionstring
failfunction
failIffunction
failIfAlmostEqualfunction
failIfEqualfunction
failUnlessfunction
failUnlessAlmostEqualfunction
failUnlessEqualfunction
failUnlessErrorfunction
failureErrorinteger
namestring
reporteqerrorfunction
reporteqerror_datetimesfunction
resultstring
runfunction
setupfunction
testfunction
testreftype(*)
typetype
valueslist

Methods

addvalue()

Description

Prototype

testcasevar.addvalue ( testcase me, type(testcasevalue) v )

Parameters
ParameterDefault valueType nameDescription
meNonetestcase
vNonetype(testcasevalue)

reporteqerror()

Description

Prototype

testcasevar.reporteqerror ( testcase me, integer id, type(=) expected, type(=) result )

Parameters
ParameterDefault valueType nameDescription
meNonetestcase
idNoneinteger
expectedNonetype(=)
resultNonetype(=)

reporteqerror_datetimes()

Description

Prototype

testcasevar.reporteqerror_datetimes ( testcase me, integer id, type(*) expected, type(*) result, function evalfunc, string pattern )

Parameters
ParameterDefault valueType nameDescription
meNonetestcase
idNoneinteger
expectedNonetype(*)
resultNonetype(*)
evalfuncNonefunction
patternNonestring

run()

Description

Prototype

testcasevar.run ( testcase me )

Parameters
ParameterDefault valueType nameDescription
meNonetestcase