--- a +++ b/Tests/test_calibration_lowerbody.any @@ -0,0 +1,108 @@ +//define = ( +// [ +// {'BM_LEG_MODEL':'_LEG_MODEL_TLEM1_'}, +// {'BM_LEG_MODEL':'_LEG_MODEL_TLEM2_'}, +// {'BM_LEG_MODEL':'_LEG_MODEL_LEG_'}, +// ], +// [ +// {'BM_CALIBRATION_TYPE':'1'}, +// {'BM_CALIBRATION_TYPE':'2'}, +// ] +//) +//ignore_errors = ['Currently, no room for tendon'] + +#include "libdef.any" + +#ifndef TEST_NAME + #define EVALUATE_JOINT_STRENGTH 1 + #define BM_CALIBRATION_TYPE 2 + #define BM_LEG_MODEL _LEG_MODEL_TLEM2_ + #define TEST_NAME "GUI" +#endif + + +#define BM_SCALING _SCALING_NONE_ +// +#define BM_LEG_TRUNK_INTERFACE _MORPH_TRUNK_TO_LEG_ +#define BM_LEG_MUSCLES_RIGHT _MUSCLES_3E_HILL_ +#define BM_TRUNK_MUSCLES OFF + +#define BM_LEG_LEFT OFF +#define BM_ARM_RIGHT OFF +#define BM_ARM_LEFT OFF + + +Main = +{ + + #include "<ANYBODY_PATH_BODY>/HumanModel.any" + + AnyOperation& RunTest = Main.HumanModel.Calibration.CalibrationSequence; + + AnyObjectPtrArray muscles_from_cal_studies = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.Calibration, "MuscleArr"))); + AnyObjectPtrArray muscles_leg = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.BodyModel.Right.Leg.Mus, "*", "AnyMuscle"))); + AnyObjectPtrArray muscles_trunk = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.BodyModel.Trunk.MusclesSpineRight, "*", "AnyMuscle"))); + AnyObjectPtrArray muscles_from_model = arrcat(muscles_leg, muscles_trunk); + + AnyInt test_all_mus_in_cal = expect( + eqfun( + NumElemOf(muscles_from_cal_studies), + NumElemOf(muscles_from_model) + ), + "The number of muscles in the calibration studies do not match the number of muscles in the model!" + ); +}; + + + + +/* + +# Test Documentation: + +The test framework pytest is used to run tests. + +Test files are identified by prefixing `test_` to the file names. Such files +will be collected automatically by the Pytest framework. + +To run the test type the following at the command prompt: + +> pytest + + +## Test specifications + +The first part of the `test_xxx.any` can include specifications for the test framework. +Things such as define and part statements or certain errors to ignore. + +The specification section must be commented with //. The test will execute that part of +the file as python code. So the code must be valid python code except for the leading // + + +### Specifying define statements: + +The following specifications are supported: + +* define +* path +* expected_errors +* ignore_errors +* expect_errors + + +// Note. Since this test example include a main file from another +// application it also alters the ANYBODY_PATH_MAINFILEDIR and +// ANYBODY_PATH_MAINFILE preprocessor flags. +// +// If these flags are important to the model they must be mocked by the +// test framework. This can be done by adding the following test directives +// to the top of the test file. + + +## + +//path = {'ANYBODY_PATH_MAINFILEDIR':'../Application/Examples/StandingModel', +// 'ANYBODY_PATH_MAINFILE':'../Application/Examples/StandingModel/StandingModel.Main.any' } +// + +*/ \ No newline at end of file