Mercurial > hg > audiodb
changeset 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 | ac1662433fe6 |
children | 7d6dd067d12e |
files | libtests/0030/prog1.c libtests/test_utils_lib.h |
diffstat | 2 files changed, 8 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/libtests/0030/prog1.c Sun Nov 16 21:18:34 2008 +0000 +++ b/libtests/0030/prog1.c Sun Nov 16 21:18:40 2008 +0000 @@ -148,7 +148,7 @@ //cmp testoutput test-expected-output myadbquery.querytype="sequence"; myadbquery.feature="testquery"; - myadbquery.power="testquerypower"; + //myadbquery.power="testquerypower"; myadbquery.sequencelength="2"; myadbquery.qpoint="0"; //myadbquery.absolute_threshold=0.0;
--- a/libtests/test_utils_lib.h Sun Nov 16 21:18:34 2008 +0000 +++ b/libtests/test_utils_lib.h Sun Nov 16 21:18:40 2008 +0000 @@ -6,7 +6,7 @@ int testoneresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist,double Qpos,double Spos); double doubleabs(double foo); void maketestfile(char * filename, int * ivals, double * dvals, int dvalsize); -int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist); +int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, int count); void makekeylistfile(char * filename, char * item); @@ -149,29 +149,21 @@ } -int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist){ +int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, int count){ int ret=0; - double tolerance=.0001; - - if (strcmp(Rlist,myadbqueryresult->Rlist[i])){ ret=-1; } - - if (doubleabs((double)Dist - (double)myadbqueryresult->Dist[i]) > tolerance){ + /* KLUDGE: at the moment, the structure returned from "sequence" + queries with a radius has two unused fields, Dist and Qpos, and + the Spos field is punned to indicate the count of hits from + that track. This is really ugly and needs to die. */ + if (count != myadbqueryresult->Spos[i]) { ret=-1; } - - //if (doubleabs((double)Qpos - (double)myadbqueryresult->Qpos[i]) > tolerance){ - // ret=-1; - //} - - //if (doubleabs((double)Spos - (double)myadbqueryresult->Spos[i]) > tolerance){ - // ret=-1; - //} return ret; }