Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
m-unit-tests
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
m-unit-tests
Commits
c8902ed8
Commit
c8902ed8
authored
10 years ago
by
Stéphane Adjemian
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation for main routines.
parent
507181cc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/source/index.rst
+108
-2
108 additions, 2 deletions
doc/source/index.rst
with
108 additions
and
2 deletions
doc/source/index.rst
+
108
−
2
View file @
c8902ed8
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
You can adapt this file completely to your liking, but it should at least
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
contain the root `toctree` directive.
Welcome to
m-unit-tests
's documentation!
Dynare's
m-unit-tests
module
============================
============
============================
Contents:
Contents:
...
@@ -12,6 +12,112 @@ Contents:
...
@@ -12,6 +12,112 @@ Contents:
:maxdepth: 2
:maxdepth: 2
.. function:: get_directory_description(basedir)
Returns a list of ``*.m`` files in directory ``basedir`` and its
subfolders. The input argument ``basedir`` is a string and the
returned argument is cell of strings with \\(n\\) elements where
each element is the relative address of a file. The default value
for ``basedir``is the current directory.
.. function:: is_unitary_test_available(fname)
Returns ``1`` if unitary tests defined in matlab routine ``fname``
have to be run, ``0`` otherwise. The mandatory input argument
``fname`` is a string. The returned argument is set equal to one if
and only if the first line contains the following comment:
.. code-block:: matlab
% --*-- Unitary tests --*--
after the function header.
.. function:: mtest(fname[, fpath])
Extracts unit test sections from matlab's routine ``fname``
executes the tests and reports results.
**INPUTS**
- ``fname`` (*string*) Name of the Matlab routine where unit
tests to be run are defined.
- ``fpath`` (*string*) Path to the routine (optional).
**OUTPUTS**
- ``check`` (*integer*) Scalar equal to 0 if the test fails and 1
otherwise.
- ``info`` (*cell*) Describes the test results. Cell info has nn
rows and five columns. Each row correponds to a unitary test in
fname, and the columns report the following informations:
- Column 1 Name of the tested routine.
- Column 2 Number of the unitary test.
- Column 3 Status of the unitary test (0 if the unitary test fails, 1 otherwise).
- Column 4 Details about the failure (vector of 0 and 1).
- Column 5 Elapsed time in seconds (cpu time).
**REMARKS**
1. If only one input argument is provided, ``fname`` must contain
the full path to the routine.
2. For each unit test, :func:`mtest` generates a matlab function
saved in ``<fname>_test_x.m`` and runs the function. If the
function does not return errors the file is erased, otherwise the
file is kept on disk.
.. function:: dtest(fname[, tpath])
Runs unit tests defined in ``fname``, by calling :func:`mtest`
routine, and displays the results.
**INPUTS**
- ``fname`` (*string*) Name (with path) of the Matlab routine
where unit tests to be run are defined.
- ``tpath`` (*string*) Path to the folder where the test routines
generated by :func:`mtest` should be temporarly saved
(optional, default value is the current directory).
**OUTPUTS**
None
**REMARKS**
1. The full path to the tested routine must be provided in ``fname``.
.. function:: run_unitary_tests(listoffiles)
Runs unitary tests defined in a collection of files.
**INPUTS**
- ``listoffiles`` (*cell of strings*) The list of m files (with
path) where the unitary tests are written. This cell, with
\\(n\\) elements, is the output of :func:`get_directory_description` routine.
**OUTPUTS**
- ``report`` (*cell*) Results of the unitary tests (\\(n\\) rows
and five columns). Each row stores the second output argument
of :func:`mtest` routine (info).
- ``time`` (*double*) Current date and time as date vector (see
matlab's documentation for the ``clock`` function).
.. function:: run_unitary_tests_in_directory(dirname[, savereport[, printreport, sendreport])
Runs all the unitary tests defined in a directory (and subfolders).
**INPUTS**
- ``dirname`` (*string*) Path to the directory.
- ``savereport`` (*integer*) Scalar equal to ``0`` or ``1``. If equal to ``1`` generated report is saved in a ``*.mat`` file.
- ``printreport`` (*integer*) Scalar equal to ``0`` or ``1``. If equal to ``1`` generated report is printed on screen.
- ``sendreport`` (*integer*) Scalar equal to ``0`` or ``1``. If equal to ``1`` generated report is sent by email.
**OUTPUTS**
- ``report`` (*cell*) First output argument of :func:`run_unitary_test routine`.
**REMARKS**
1. Git needs to be available on the system, and it is assumed that the content of ``dirname`` is versionned with Git.
Indices and tables
Indices and tables
==================
==================
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment