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 imports 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 allNonekeywords in this line intoNULL.#+cimport: Transform allimportkeywords in this line intocimport.#+cdef: Add acdefto this line. For functions or methods that means to changedefintocdefin the function signature. For classes that means to changeclasstocdef class.#+cpdef: Same as#+cdef, but addcpdefinstead.#+cdef-foobar-bizz: Same as#+cdef, but also add the additional wordsfoobar bizzaftercdef. Arbitrary words may be specified and the number of words is not limited. The dash-will be transformed into a space character.#+likely: Mark anifcondition as being likely to evaluate to True. This annotation can only be used in lines with anifstatement. It helps the C compiler to generate better machine code.#+unlikely: Mark anifcondition as being unlikely to evaluate to True. This annotation can only be used in lines with anifstatement. It helps the C compiler to generate better machine code.#+suffix-u: Add anusuffix to all decimal and hexadecimal immediates in the line.#+suffix-LL: Add anLsuffix 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 Pythoncoveragetracing.