comparison libtests/test_utils_lib.h @ 379:7e6c99481b8b

Fix two more tests * testoneradiusresult() was comparing the wrong fields; * there was a stray power flag in libtests/0030 (I am a little bit suspicious of the reuse of the "myadbquery" variable within a single test; I don't see anything that clears out old values from the struct, so subsequent calls will retain them. It might be that those old values are harmless, but I think this calls for a bit of test file reworking...)
author mas01cr
date Sun, 16 Nov 2008 21:18:40 +0000
parents 94c18f128ce8
children e072aa1611f5 342822c2d49a
comparison
equal deleted inserted replaced
378:ac1662433fe6 379:7e6c99481b8b
4 unsigned int test_insert( adb_ptr d, char * features, char * power, char * key); 4 unsigned int test_insert( adb_ptr d, char * features, char * power, char * key);
5 void dump_query(adb_query_ptr adbq, adb_queryresult_ptr myadbqueryresult); 5 void dump_query(adb_query_ptr adbq, adb_queryresult_ptr myadbqueryresult);
6 int testoneresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist,double Qpos,double Spos); 6 int testoneresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist,double Qpos,double Spos);
7 double doubleabs(double foo); 7 double doubleabs(double foo);
8 void maketestfile(char * filename, int * ivals, double * dvals, int dvalsize); 8 void maketestfile(char * filename, int * ivals, double * dvals, int dvalsize);
9 int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist); 9 int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, int count);
10 void makekeylistfile(char * filename, char * item); 10 void makekeylistfile(char * filename, char * item);
11 11
12 12
13 13
14 14
147 147
148 return ret; 148 return ret;
149 } 149 }
150 150
151 151
152 int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist){ 152 int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, int count){
153 153
154 int ret=0; 154 int ret=0;
155 double tolerance=.0001; 155
156
157
158
159 if (strcmp(Rlist,myadbqueryresult->Rlist[i])){ 156 if (strcmp(Rlist,myadbqueryresult->Rlist[i])){
160 ret=-1; 157 ret=-1;
161 } 158 }
162 159
163 160 /* KLUDGE: at the moment, the structure returned from "sequence"
164 if (doubleabs((double)Dist - (double)myadbqueryresult->Dist[i]) > tolerance){ 161 queries with a radius has two unused fields, Dist and Qpos, and
165 ret=-1; 162 the Spos field is punned to indicate the count of hits from
166 } 163 that track. This is really ugly and needs to die. */
167 164 if (count != myadbqueryresult->Spos[i]) {
168 //if (doubleabs((double)Qpos - (double)myadbqueryresult->Qpos[i]) > tolerance){ 165 ret=-1;
169 // ret=-1; 166 }
170 //}
171
172 //if (doubleabs((double)Spos - (double)myadbqueryresult->Spos[i]) > tolerance){
173 // ret=-1;
174 //}
175 167
176 return ret; 168 return ret;
177 } 169 }
178 170
179 171