The unit test suite can be run with the invocation of the command ./tests/run.sh
. This will run all unit tests and show the results.
Please see ./tests/run.sh --help
for more options.
To run a code statement coverage trace during unit testing the option ./tests/run.sh --coverage
is available. The results will be stored in ./code-coverage-report/
. It is desired to have a reasonable code coverage of the unit tests. All main code paths should be covered.
In order to support both compiling the Awlsim core with Cython and running the same code in a plain Python interpreter without compilation, a method to patch the files is required. The setup.py scrips patch each .py source file and create a .pyx file before starting Cython compilation. The Cython patching mechanism rewrites all import
s to import the compiled Cython modules instead of the plain Python modules. In addition to that some special comments are provided as hint to the Cython patcher:
#@cy
: Enable (un-comment) this line during Cython patching.#@cy-posix
: Enable (un-comment) this line during Cython patching, if compiling for a Posix platform.#@cy-win
: Enable (un-comment) this line during Cython patching, if compiling for a Windows platform.#@nocy
: Disable (comment) this line during Cython patching.#@no-cython-patch
: Do not touch this line during cython patching.#+NoneToNULL
: Transform allNone
keywords in this line intoNULL
.#+cimport
: Transform allimport
keywords in this line intocimport
.#+cdef
: Add acdef
to this line. For functions or methods that means to changedef
intocdef
in the function signature. For classes that means to changeclass
tocdef class
.#+cpdef
: Same as#+cdef
, but addcpdef
instead.#+cdef-foobar-bizz
: Same as#+cdef
, but also add the additional wordsfoobar bizz
aftercdef
. Arbitrary words may be specified and the number of words is not limited. The dash-
will be transformed into a space character.#+likely
: Mark anif
condition as being likely to evaluate to True. This annotation can only be used in lines with anif
statement. It helps the C compiler to generate better machine code.#+unlikely
: Mark anif
condition as being unlikely to evaluate to True. This annotation can only be used in lines with anif
statement. It helps the C compiler to generate better machine code.#+suffix-u
: Add anu
suffix to all decimal and hexadecimal immediates in the line.#+suffix-LL
: Add anL
suffix to all decimal and hexadecimal immediates in the line.
To disable code coverage tracing an additional special comment is provided:
#@nocov
: This excludes the line from Pythoncoverage
tracing.