Changeset 1800
- Timestamp:
- Sep 13, 2004, 12:19:51 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataManip/tst_psMinimize05.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataManip/tst_psMinimize05.c
r1799 r1800 6 6 #include "psTest.h" 7 7 #include <math.h> 8 #define N 28 #define N 5 9 9 #define MIN_VALUE 20.0 10 10 #define NUM_PARAMS 10 11 11 float expectedParm[NUM_PARAMS]; 12 int testStatus = true; 12 13 13 14 /***************************************************************************** … … 16 17 adds MIN_VALUE to it. The minimum for this function will be MIN_VALUE, and 17 18 will occur when each parameter equals the associated value in expectedParm[]. 19 20 This procedure ignores the coordinates, other than to ensure that they were 21 passed correctly from psMinimizePowell(). 18 22 *****************************************************************************/ 19 23 float myFunc(psVector *myParams, … … 21 25 { 22 26 float sum = 0.0; 27 float coordData = 0.0; 28 float expData = 0.0; 23 29 int i; 30 31 for (i=0;i<N;i++) { 32 coordData = ((psVector *) (myCoords->data[i]))->data.F32[0]; 33 expData = (float) (i+10); 34 if (fabs(coordData - expData) > FLT_EPSILON) { 35 printf("ERROR(1): coordinate data was incorrectly passed to myFunc()\n"); 36 printf("ERROR(1): was (%f) should be (%f)\n", coordData, expData); 37 testStatus = false; 38 } 39 coordData = ((psVector *) (myCoords->data[i]))->data.F32[1]; 40 expData = (float) (i+3); 41 if (fabs(coordData - expData) > FLT_EPSILON) { 42 printf("ERROR(2): coordinate data was incorrectly passed to myFunc()\n"); 43 printf("ERROR(2): was (%f) should be (%f)\n", coordData, expData); 44 testStatus = false; 45 } 46 } 47 24 48 25 49 sum = 0.0; … … 36 60 { 37 61 int currentId = psMemGetId(); 38 int testStatus = true;39 62 int memLeaks = 0; 40 63 int i = 0; … … 54 77 for (i=0;i<N;i++) { 55 78 myCoords->data[i] = (psPTR *) psVectorAlloc(2, PS_TYPE_F32); 56 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) i;57 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) i;79 ((psVector *) (myCoords->data[i]))->data.F32[0] = (float) (i+10); 80 ((psVector *) (myCoords->data[i]))->data.F32[1] = (float) (i+3); 58 81 } 59 82 for (i=0;i<NUM_PARAMS;i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
