Skip to content

Commit

Permalink
docs reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Dec 21, 2021
1 parent e377dda commit 2d5e7d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
1 change: 0 additions & 1 deletion doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Contributing

MRPT_Coding_Style.rst
mrpt_git_branches.rst
unit_testing.rst
ClangFormat.rst
ClangFormat_internal.rst
make_a_mrpt_release.rst
Expand Down
1 change: 1 addition & 0 deletions doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ MRPT
applications
examples
supported-sensors
unit_testing
children-projects

.. toctree::
Expand Down
36 changes: 20 additions & 16 deletions doc/source/unit_testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@
Unit testing in MRPT
======================

Each MRPT `library <modules.html>`_ has its own set of `unit tests <https://en.wikipedia.org/wiki/Unit_testing>`_
to verify and enssure that classes and functions behave as expected.
There are hundreds of tests covering operations from elemental matrix operations up to the execution of complex SLAM
algorithms with predefined datasets, in many cases using randomized data and several input datasets for each test.
In all cases, the results are compared to the expected values and errors are reported upon mismatches.
This reduces the chances of introducing `regressions <https://en.wikipedia.org/wiki/Software_regression>`_ in the future.

MRPT uses Google ``gtest`` unit testing library.
CMake scripts take care of of recognizing all those source files that implement tests
(which are identified by filename suffix ``*_unittest.cpp``, as explained `here <tutorial-lib-layout.html>`_)
and move them into special binary targets which are executed upon testing.
One test target is created per mrpt module.
Take a look at any file named ``*_unittest.cpp`` for examples (e.g. `math/src/geometry_unittest.cpp <https://github.com/MRPT/mrpt/blob/develop/libs/math/src/geometry_unittest.cpp>`_)

======================
Running unit tests
======================
----------------------

Useful build targets:

Expand All @@ -43,3 +28,22 @@ Useful build targets:
- ``make test_mrpt_foo``: Builds the test application for the mrpt library "foo".

- ``make run_tests_mrpt_foo``: Builds and runs the test for the mrpt library "foo".


Rationale
-------------

Each MRPT `library <modules.html>`_ has its own set of `unit tests <https://en.wikipedia.org/wiki/Unit_testing>`_
to verify and enssure that classes and functions behave as expected.
There are hundreds of tests covering operations from elemental matrix operations up to the execution of complex SLAM
algorithms with predefined datasets, in many cases using randomized data and several input datasets for each test.
In all cases, the results are compared to the expected values and errors are reported upon mismatches.
This reduces the chances of introducing `regressions <https://en.wikipedia.org/wiki/Software_regression>`_ in the future.

MRPT uses Google ``gtest`` unit testing library.
CMake scripts take care of of recognizing all those source files that implement tests
(which are identified by filename suffix ``*_unittest.cpp``, as explained `here <tutorial-lib-layout.html>`_)
and move them into special binary targets which are executed upon testing.
One test target is created per mrpt module.
Take a look at any file named ``*_unittest.cpp`` for examples (e.g. `math/src/geometry_unittest.cpp <https://github.com/MRPT/mrpt/blob/develop/libs/math/src/geometry_unittest.cpp>`_)

0 comments on commit 2d5e7d7

Please sign in to comment.