| 1 | /* | 
|---|
| 2 | * Project: MoleCuilder | 
|---|
| 3 | * Description: creates and alters molecular systems | 
|---|
| 4 | * Copyright (C)  2010 University of Bonn. All rights reserved. | 
|---|
| 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
| 6 | */ | 
|---|
| 7 |  | 
|---|
| 8 | /** | 
|---|
| 9 | * \file code-tests.dox | 
|---|
| 10 | * | 
|---|
| 11 | * Created on: Oct 28, 2011 | 
|---|
| 12 | *    Author: heber | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 |  | 
|---|
| 16 | /** | 
|---|
| 17 | * \page codetest "Code tests" | 
|---|
| 18 | * | 
|---|
| 19 | * Code tests enforce certain principles which the programmer must follow. | 
|---|
| 20 | * | 
|---|
| 21 | * At this moment these are: | 
|---|
| 22 | * -# Every .cpp files must include \b config.h and \b CodePatterns/MemDebug.hpp | 
|---|
| 23 | * -# Every .hpp files must include \b config.h | 
|---|
| 24 | * -# Every .dox file contains a (correctly formatted: YYYY-MM-DD) date stamp. | 
|---|
| 25 | * -# Every .cpp file must contain a correct copyright header | 
|---|
| 26 | * -# Every .hpp file must be present in a Makefile.am (for distributable archive) | 
|---|
| 27 | * | 
|---|
| 28 | * These make sure that the memory debugger is catching every movement on the | 
|---|
| 29 | * heap and that every module knows about the behavior controling \e #define's that | 
|---|
| 30 | * are checked by autoconf and written to \b config.h in the build directory. And | 
|---|
| 31 | * also that for every documentation file it is known when it was current. | 
|---|
| 32 | * | 
|---|
| 33 | * \section codetest-structure Directory structure | 
|---|
| 34 | * | 
|---|
| 35 | * The code tests are contained in \b tests/CodeChecks. Therein are all test | 
|---|
| 36 | * scripts gathered that use autotest (http://www.gnu.org/s/hello/manual/autoconf/Using-Autotest.html#Using-Autotest). | 
|---|
| 37 | * Mostly, these look through files | 
|---|
| 38 | * | 
|---|
| 39 | * \section codetest-launch-all Launching all tests | 
|---|
| 40 | * | 
|---|
| 41 | *  In order to launch all tests, simply do: | 
|---|
| 42 | *  -# Enter \b tests/CodeChecks in your build directory | 
|---|
| 43 | *  -# Run | 
|---|
| 44 | *    \code make check \endcode | 
|---|
| 45 | *    there | 
|---|
| 46 | * | 
|---|
| 47 | * \section codetest-launch-some Launching some tests | 
|---|
| 48 | * | 
|---|
| 49 | *  Launching a single or just some of the tests is only a little bit more | 
|---|
| 50 | *  complicated. Proceed as follows: | 
|---|
| 51 | *  -# Enter \b tests/CodeChecks in your build directory | 
|---|
| 52 | *  -# Run | 
|---|
| 53 | *  \code ../../../tests/CodeChecks/testsuite <option> AUTOTEST_PATH="<buildpath>/src" \endcode, | 
|---|
| 54 | *  where \a <option> is explained in the subsections below and \a <buildpath> is | 
|---|
| 55 | *  the build path (i.e. the variable \a AUTOTEST_PATH should contain the path to | 
|---|
| 56 | *  the executable). | 
|---|
| 57 | * | 
|---|
| 58 | *  \subsection regressiontest-launch-by-number ... by number | 
|---|
| 59 | * | 
|---|
| 60 | *    Tests can be launched by specifying their test number, e.g. then \a <option> | 
|---|
| 61 | *    might be \a 1 or \a 1-2 or just nothing for all of them. | 
|---|
| 62 | * | 
|---|
| 63 | *  \subsection regressiontest-launch-by-keyword .. by keyword | 
|---|
| 64 | * | 
|---|
| 65 | *    Tests may as well be launched by some keywords, e.g. each code check has | 
|---|
| 66 | *    a specific keyword which is given via \b AT_KEYWORD directive of Autotest. | 
|---|
| 67 | *    I.e. we may launch the test on \b config.h presence via the \a <option> | 
|---|
| 68 | *    \a -k \a config_h. Also multiple keywords may be given. | 
|---|
| 69 | * | 
|---|
| 70 | * \section codetest-results Inspecting results | 
|---|
| 71 | * | 
|---|
| 72 | *  The testsuite can be launched with the additional option of \a -d which leaves the | 
|---|
| 73 | *  directory of the test present even though the test has passed for inspection. | 
|---|
| 74 | * | 
|---|
| 75 | *  If a test fails, in whatever way it was launched, will leave in the build directory | 
|---|
| 76 | *  a folder \b tests/CodeChecks/testsuite.dir/<nr> where \a <nr> is the number of the | 
|---|
| 77 | *  test (padded maybe with some zeros). | 
|---|
| 78 | * | 
|---|
| 79 | *  In the current state tests will fail because one file does not include \b | 
|---|
| 80 | *  config.h or \b MemDebug.hpp. Hence, check the testsuite's log to get the file | 
|---|
| 81 | *  name of the culprit at its very bottom. | 
|---|
| 82 | * | 
|---|
| 83 | * \section unittest-add Adding new tests | 
|---|
| 84 | * | 
|---|
| 85 | *  \attention Name convention of files, (no spaces, use underscore) e.g. | 
|---|
| 86 | *  \b testsuite-config_h.at | 
|---|
| 87 | *  - the test script file should be called as follows: | 
|---|
| 88 | *    -# testsuite-... | 
|---|
| 89 | *    -# followed by the construct that is tested. | 
|---|
| 90 | * | 
|---|
| 91 | *  In order to add a new test, you have to do the following: | 
|---|
| 92 | *  -# Add a new \b testsuite-....at script to the folder \b tests/CodeChecks | 
|---|
| 93 | *    (have a look at the present ones and see above for help on the commands | 
|---|
| 94 | *    recognized by Autotest. \e Mind \e giving it a suitable \e keyword!). | 
|---|
| 95 | *  -# Add the file to Makefile.am such that the testsuite is re-created when | 
|---|
| 96 | *    you change the test script. | 
|---|
| 97 | *  -# Add the file as an \e m4_include directive to testsuite.at. | 
|---|
| 98 | * | 
|---|
| 99 | *  These files may also contain exceptions which are stored as a simple list of | 
|---|
| 100 | *  files for which one of the above rules does not apply. | 
|---|
| 101 | * | 
|---|
| 102 | * \date 2014-03-10 | 
|---|
| 103 | * | 
|---|
| 104 | */ | 
|---|