comparison libtests/0005/prog1.c @ 490:13de7ba21966 api-inversion

Continue removing uses of audiodb_query() Deal with four more libtests/ cases. Of course, it would probably be "nice" or "useful" to provide an audiodb_query() implemented in terms of audiodb_query_spec() -- but that is not a task that I would enjoy.
author mas01cr
date Sat, 10 Jan 2009 15:32:58 +0000
parents e072aa1611f5
children
comparison
equal deleted inserted replaced
489:4cb6c611f812 490:13de7ba21966
1 #include "audioDB_API.h" 1 #include "audioDB_API.h"
2 #include "test_utils_lib.h" 2 #include "test_utils_lib.h"
3 3
4 int main(int argc, char **argv) {
5 adb_t *adb;
4 6
5 int main(int argc, char **argv){ 7 clean_remove_db(TESTDB);
8 if(!(adb = audiodb_create(TESTDB, 0, 0, 0)))
9 return 1;
6 10
7 int returnval=0; 11 adb_datum_t datum = {2, 2, "testfeature", (double[4]) {0, 1, 1, 0}};
8 adb_ptr mydbp={0}; 12 if(audiodb_insert_datum(adb,&datum))
9 int ivals[10]; 13 return 1;
10 double dvals[10];
11 adb_insert_t myinsert={0};
12 unsigned int myerr=0;
13 char * databasename="testdb";
14 int myerror=0;
15 14
15 if(audiodb_l2norm(adb))
16 return 1;
16 17
17 /* remove old directory */ 18 audiodb_close(adb);
18 //if [ -f testdb ]; then rm -f testdb; fi
19 clean_remove_db(databasename);
20 19
21 /* create new db */ 20 return 104;
22 //${AUDIODB} -d testdb -N
23 mydbp=audiodb_create(databasename,0,0,0);
24
25
26 /* make a test file */
27 //intstring 2 > testfeature
28 //floatstring 0 1 >> testfeature
29 //floatstring 1 0 >> testfeature
30 ivals[0]=2;
31 dvals[0]=0; dvals[1]=1; dvals[2]=1; dvals[3]=0;
32 maketestfile("testfeature",ivals,dvals,4);
33
34
35 /* insert */
36 //${AUDIODB} -d testdb -I -f testfeature
37 myinsert.features="testfeature";
38 myerr=audiodb_insert(mydbp,&myinsert);
39
40 /* turn on l2norm */
41 //echo running L2Norm
42 //${AUDIODB} -d testdb -L
43 myerror=audiodb_l2norm(mydbp);
44 if (myerror){
45 returnval=-1;
46 }
47
48
49 /* close */
50 audiodb_close(mydbp);
51
52
53
54 return(returnval);
55 } 21 }
56 22