|
a |
|
b/Tests/test_calibration_upperbody.any |
|
|
1 |
//fatal_warnings = True |
|
|
2 |
//ignore_errors = [ |
|
|
3 |
// "Muscle without strength : The muscle is unrealistically long or short", |
|
|
4 |
// "Close to singular position", |
|
|
5 |
// "Muscle calibration : Insufficient Lmt interval", |
|
|
6 |
// "The tendon/fiber length was calibrated but with issues", |
|
|
7 |
// "'Set Value' operation on this value-object has broken symbolic dependency", |
|
|
8 |
// "Calibration operation has broken one or more symbolic dependencies", |
|
|
9 |
//] |
|
|
10 |
//define = ( |
|
|
11 |
// [ |
|
|
12 |
// {'BM_CALIBRATION_TYPE':'1'}, |
|
|
13 |
// {'BM_CALIBRATION_TYPE':'2'}, |
|
|
14 |
// ] |
|
|
15 |
//) |
|
|
16 |
// |
|
|
17 |
#include "libdef.any" |
|
|
18 |
|
|
|
19 |
#ifndef TEST_NAME |
|
|
20 |
#define BM_CALIBRATION_TYPE 2 |
|
|
21 |
#define TEST_NAME "test_calibration_upperbody.any_1" |
|
|
22 |
#endif |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
#define BM_ARM_SHOULDER_RHYTHM ON |
|
|
26 |
|
|
|
27 |
#define BM_ARM_MUSCLES_RIGHT _MUSCLES_3E_HILL_ |
|
|
28 |
#define BM_ARM_MUSCLES_LEFT _MUSCLES_3E_HILL_ |
|
|
29 |
|
|
|
30 |
#define BM_TRUNK_LUMBAR_LIGAMENTS OFF |
|
|
31 |
#define BM_TRUNK_CERVICAL_MUSCLES OFF |
|
|
32 |
|
|
|
33 |
#define BM_LEG_LEFT OFF |
|
|
34 |
#define BM_LEG_RIGHT OFF |
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
Main = |
|
|
39 |
{ |
|
|
40 |
#include "<ANYBODY_PATH_BODY>/HumanModel.any" |
|
|
41 |
|
|
|
42 |
AnyOperation& RunTest = Main.HumanModel.Calibration.CalibrationSequence; |
|
|
43 |
|
|
|
44 |
AnyObjectPtrArray muscles_from_cal_studies = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.Calibration, "MuscleArr"))); |
|
|
45 |
AnyObjectPtrArray muscles_right = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.BodyModel.Right.ShoulderArm.Mus, "*", "AnyMuscle"))); |
|
|
46 |
AnyObjectPtrArray muscles_left = unique(flattenptr(ObjSearchRecursive(&Main.HumanModel.BodyModel.Left.ShoulderArm.Mus, "*", "AnyMuscle"))); |
|
|
47 |
AnyObjectPtrArray muscles_from_model = arrcat(muscles_right, muscles_left); |
|
|
48 |
|
|
|
49 |
AnyInt test_all_mus_in_cal = expect( |
|
|
50 |
eqfun( |
|
|
51 |
NumElemOf(muscles_from_cal_studies), |
|
|
52 |
NumElemOf(muscles_from_model) |
|
|
53 |
), |
|
|
54 |
"The number of muscles in the calibration studies do not match the number of muscles in the model!" |
|
|
55 |
); |
|
|
56 |
}; |
|
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
|
61 |
/* |
|
|
62 |
|
|
|
63 |
# Test Documentation: |
|
|
64 |
|
|
|
65 |
The test framework pytest is used to run tests. |
|
|
66 |
|
|
|
67 |
Test files are identified by prefixing `test_` to the file names. Such files |
|
|
68 |
will be collected automatically by the Pytest framework. |
|
|
69 |
|
|
|
70 |
To run the test type the following at the command prompt: |
|
|
71 |
|
|
|
72 |
> pytest |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
## Test specifications |
|
|
76 |
|
|
|
77 |
The first part of the `test_xxx.any` can include specifications for the test framework. |
|
|
78 |
Things such as define and part statements or certain errors to ignore. |
|
|
79 |
|
|
|
80 |
The specification section must be commented with //. The test will execute that part of |
|
|
81 |
the file as python code. So the code must be valid python code except for the leading // |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
### Specifying define statements: |
|
|
85 |
|
|
|
86 |
The following specifications are supported: |
|
|
87 |
|
|
|
88 |
* define |
|
|
89 |
* path |
|
|
90 |
* expected_errors |
|
|
91 |
* ignore_errors |
|
|
92 |
* expect_errors |
|
|
93 |
|
|
|
94 |
|
|
|
95 |
// Note. Since this test example include a main file from another |
|
|
96 |
// application it also alters the ANYBODY_PATH_MAINFILEDIR and |
|
|
97 |
// ANYBODY_PATH_MAINFILE preprocessor flags. |
|
|
98 |
// |
|
|
99 |
// If these flags are important to the model they must be mocked by the |
|
|
100 |
// test framework. This can be done by adding the following test directives |
|
|
101 |
// to the top of the test file. |
|
|
102 |
|
|
|
103 |
|
|
|
104 |
## |
|
|
105 |
|
|
|
106 |
//path = {'ANYBODY_PATH_MAINFILEDIR':'../Application/Examples/StandingModel', |
|
|
107 |
// 'ANYBODY_PATH_MAINFILE':'../Application/Examples/StandingModel/StandingModel.Main.any' } |
|
|
108 |
// |
|
|
109 |
|
|
|
110 |
*/ |