source:
trunk/docs/docs_dev/source/guides/rundemotest.rst
@
630
Last change on this file since 630 was 630, checked in by pinsard, 10 years ago | |
---|---|
|
|
File size: 2.2 KB |
Demo and test
PROJECT is written different languages : MATLAB or octave, IDL, ferret.
octave and Python give us the opportunity to embed unit demo and tests in source files (see :ref:`coding_rules`)
Test and demo must be run before :command:`commit`.
Note
We do not know yet how to handle source files dependencies so it is up to contributors to define test sequences.
Python
$ cd ${PROJECT}/src $ nosetests --with-doctest -v *.py
or:
$ cd ${PROJECT}/src $ coverage -rm -o *.py
octave
All demos can be launched with one octave command:
$ cd ${PROJECT}/src $ octave octave> varamma_startup
$ cd ${PROJECT}/src $ octave octave> demo('module_to_be_demonstrated') octave> test('module_to_be_tested')
MATLAB
MATLAB do not understand doctest features like octave.
To run demo and tests, we need first extract doctests from source files:
$ cd ${PROJECT}/adm $ make clean $ make before $ make matlab_demo $ make matlab_test
Then MATLAB codes for demo and tests are available in :file:`${PROJECT}/adm/demo` and :file:`${PROJECT}/adm/test`.
Warning
MATLAB do not understand :command:`fail` and :command:`assert` is not use like in octave ... so tests might not be significant.
To run them:
$ cd ${PROJECT}/src $ matlab -nodesktop matlab> add_path('../adm/demo') matlab> module_to_be_demonstrated_demo matlab> add_path('../adm/test') matlab> module_to_be_tested_test
IDL
We do not yet have a doctest like solution for IDL. PyIDL will be studied. Until then, some IDL source files dedicated to test and demo must be written in :file:`${PROJECT}/src/demo` and :file:`${PROJECT}/src/test`.