<commit_before>#ifndef SimTK_SimTKCOMMON_TESTING_H_
#define SimTK_SimTKCOMMON_TESTING_H_

/* -------------------------------------------------------------------------- *
 *                       Simbody(tm): SimTKcommon                             *
 * -------------------------------------------------------------------------- *
 * This is part of the SimTK biosimulation toolkit originating from           *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
 *                                                                            *
 * Portions copyright (c) 2009-14 Stanford University and the Authors.        *
 * Authors: <NAME>                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
 * not use this file except in compliance with the License. You may obtain a  *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing, software        *
 * distributed under the License is distributed on an "AS IS" BASIS,          *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
 * See the License for the specific language governing permissions and        *
 * limitations under the License.                                             *
 * -------------------------------------------------------------------------- */

#include "SimTKcommon/basics.h"
#include "SimTKcommon/Simmatrix.h"
#include "SimTKcommon/internal/Random.h"
#include "SimTKcommon/internal/Timing.h"

#include <cmath>     
#include <algorithm> 
#include <iostream>

/** @file
 * This file defines a SimTK::Test class and some related macros which
 * provide functionality useful in regression tests.
 */

namespace SimTK {

/**@defgroup RegressionTesting    SimTK Regression Testing
 *
 * SimTK defines some utilities to facilitate the creation of regression
 * tests for SimTK facilities. These utilities consist of a SimTK::Test
 * class and related support macros.
 *
 * Features include:
 *      - uniform, readable output including execution times
 *      - identical comparison tests for all numerical types, scalar and composite
 *      - careful treatment of numerical tolerances using relative and absolute
 *          comparisons, with provision for size-dependent, reduced accuracy
 *          expectations for matrix operations
 *      - default tolerance varies with precision (caller can override)
 *      - convenient generation of random test data
 *      - convenient testing of required argument checking (i.e., test
 *          fails unless an exception is thrown)
 *
 * The Testing.h header file is
 * <em>not</em> automatically included with SimTKcommon.h; you have to
 * ask for it explicilty. Here's how you use this facility:
 * <pre>
 * \#include "SimTKcommon/Testing.h"
 * void myFirstSubtest() {...}
 * void myNextSubtest() {...}
 * int main() {
 *      SimTK_START_TEST("OverallTestName");
 *          SimTK_SUBTEST(myFirstSubtest);
 *          SimTK_SUBTEST(myNextSubtest);
 *      SimTK_END_TEST();
 * }
 * </pre>
 * The arguments to SimTK_SUBTEST are function names and will be
 * called with "()" appended. If your subtest functions have arguments,
 * use SimTK_SUBTEST1(name,arg) or SimTK_SUBTEST2(name,arg1,arg2) which
 * will call name(arg) or name(arg1,arg2) as appropriate.
 *
 * This will result in nice output including execution times for
 * the overall test and the individual subtests, and arrange for 
 * any exceptions raised in the tests to be caught, properly reported,
 * and cause a non-zero return from main(). If everything runs
 * successfully, main() will return 0. Here is an example of the
 * output produced:
 * <pre>
 * Starting test TestScalar ...
 *   testIsNaN            ... done. testIsNaN            time: 0ms.<commit_msg>Fix doxygen comment<commit_after>#ifndef SimTK_SimTKCOMMON_TESTING_H_
#define SimTK_SimTKCOMMON_TESTING_H_

/* -------------------------------------------------------------------------- *
 *                       Simbody(tm): SimTKcommon                             *
 * -------------------------------------------------------------------------- *
 * This is part of the SimTK biosimulation toolkit originating from           *
 * Simbios, the NIH National Center for Physics-Based Simulation of           *
 * Biological Structures at Stanford, funded under the NIH Roadmap for        *
 * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody.  *
 *                                                                            *
 * Portions copyright (c) 2009-15 Stanford University and the Authors.        *
 * Authors: <NAME>                                                   *
 * Contributors:                                                              *
 *                                                                            *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may    *
 * not use this file except in compliance with the License. You may obtain a  *
 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0.         *
 *                                                                            *
 * Unless required by applicable law or agreed to in writing, software        *
 * distributed under the License is distributed on an "AS IS" BASIS,          *
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   *
 * See the License for the specific language governing permissions and        *
 * limitations under the License.                                             *
 * -------------------------------------------------------------------------- */

#include "SimTKcommon/basics.h"
#include "SimTKcommon/Simmatrix.h"
#include "SimTKcommon/internal/Random.h"
#include "SimTKcommon/internal/Timing.h"

#include <cmath>     
#include <algorithm> 
#include <iostream>

/** @file
 * This file defines a SimTK::Test class and some related macros which
 * provide functionality useful in regression tests.
 */

namespace SimTK {

/**@defgroup RegressionTesting    SimTK Regression Testing
 *
 * SimTK defines some utilities to facilitate the creation of regression
 * tests for SimTK facilities. These utilities consist of a SimTK::Test
 * class and related support macros.
 *
 * Features include:
 *      - uniform, readable output including execution times
 *      - identical comparison tests for all numerical types, scalar and composite
 *      - careful treatment of numerical tolerances using relative and absolute
 *          comparisons, with provision for size-dependent, reduced accuracy
 *          expectations for matrix operations
 *      - default tolerance varies with precision (caller can override)
 *      - convenient generation of random test data
 *      - convenient testing of required argument checking (i.e., test
 *          fails unless an exception is thrown)
 *
 * Here's how you use this facility:
 * <pre>
 * \#include "SimTKcommon.h"
 * void myFirstSubtest() {...}
 * void myNextSubtest() {...}
 * int main() {
 *      SimTK_START_TEST("OverallTestName");
 *          SimTK_SUBTEST(myFirstSubtest);
 *          SimTK_SUBTEST(myNextSubtest);
 *      SimTK_END_TEST();
 * }
 * </pre>
 * The arguments to SimTK_SUBTEST are function names and will be
 * called with "()" appended. If your subtest functions have arguments,
 * use SimTK_SUBTEST1(name,arg) or SimTK_SUBTEST2(name,arg1,arg2) which
 * will call name(arg) or name(arg1,arg2) as appropriate.
 *
 * This will result in nice output including execution times for
 * the overall test and the individual subtests, and arrange for 
 * any exceptions raised in the tests to be caught, properly reported,
 * and cause a non-zero return from main(). If everything runs
 * successfully, main() will return 0. Here is an example of the
 * output produced:
 * <pre>
 * Starting test TestScalar ...
 *   testIsNaN            ... done. testIsNaN            time: 0ms.
{'fraction_non_alphanumeric': 0.12464387464387465, 'fraction_numerical': 0.006172839506172839, 'mean_word_length': 1.8395685877991237, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4656721', 'n_tokens_mistral': 2020, 'n_tokens_neox': 1905, 'n_words': 770}