Mercurial > hg > audiodb
comparison libtests/0005/prog1.c @ 498:342822c2d49a
Merge api-inversion branch (-r656:771, but I don't expect to return to
that branch) into the trunk.
I expect there to be minor performance regressions (e.g. in the SOAP
server index cacheing, which I have forcibly removed) and minor
unplugged memory leaks (e.g. in audioDB::query(), where I don't free up
the datum). I hope that these leaks and performance regressions can be
plugged in short order. I also expect that some (but maybe not all) of
the issues currently addressed in the memory-leaks branch are superseded
or fixed by this merge.
There remains much work to be done; go forth and do it.
author | mas01cr |
---|---|
date | Sat, 10 Jan 2009 16:47:57 +0000 |
parents | 94c18f128ce8 |
children |
comparison
equal
deleted
inserted
replaced
476:a7193678280b | 498:342822c2d49a |
---|---|
1 #include <stdio.h> | 1 #include "audioDB_API.h" |
2 #include <stdlib.h> | 2 #include "test_utils_lib.h" |
3 #include <string.h> | |
4 #include <sysexits.h> | |
5 #include <fcntl.h> | |
6 #include <dirent.h> | |
7 #include <unistd.h> | |
8 #include <sys/stat.h> | |
9 /* | |
10 * * #define NDEBUG | |
11 * * */ | |
12 #include <assert.h> | |
13 | 3 |
14 #include "../../audioDB_API.h" | 4 int main(int argc, char **argv) { |
15 #include "../test_utils_lib.h" | 5 adb_t *adb; |
16 | 6 |
7 clean_remove_db(TESTDB); | |
8 if(!(adb = audiodb_create(TESTDB, 0, 0, 0))) | |
9 return 1; | |
17 | 10 |
18 int main(int argc, char **argv){ | 11 adb_datum_t datum = {2, 2, "testfeature", (double[4]) {0, 1, 1, 0}}; |
12 if(audiodb_insert_datum(adb,&datum)) | |
13 return 1; | |
19 | 14 |
20 int returnval=0; | 15 if(audiodb_l2norm(adb)) |
21 adb_ptr mydbp={0}; | 16 return 1; |
22 int ivals[10]; | |
23 double dvals[10]; | |
24 adb_insert_t myinsert={0}; | |
25 unsigned int myerr=0; | |
26 char * databasename="testdb"; | |
27 int myerror=0; | |
28 | 17 |
18 audiodb_close(adb); | |
29 | 19 |
30 /* remove old directory */ | 20 return 104; |
31 //if [ -f testdb ]; then rm -f testdb; fi | |
32 clean_remove_db(databasename); | |
33 | |
34 /* create new db */ | |
35 //${AUDIODB} -d testdb -N | |
36 mydbp=audiodb_create(databasename,0,0,0); | |
37 | |
38 | |
39 /* make a test file */ | |
40 //intstring 2 > testfeature | |
41 //floatstring 0 1 >> testfeature | |
42 //floatstring 1 0 >> testfeature | |
43 ivals[0]=2; | |
44 dvals[0]=0; dvals[1]=1; dvals[2]=1; dvals[3]=0; | |
45 maketestfile("testfeature",ivals,dvals,4); | |
46 | |
47 | |
48 /* insert */ | |
49 //${AUDIODB} -d testdb -I -f testfeature | |
50 myinsert.features="testfeature"; | |
51 myerr=audiodb_insert(mydbp,&myinsert); | |
52 | |
53 /* turn on l2norm */ | |
54 //echo running L2Norm | |
55 //${AUDIODB} -d testdb -L | |
56 myerror=audiodb_l2norm(mydbp); | |
57 if (myerror){ | |
58 returnval=-1; | |
59 } | |
60 | |
61 | |
62 /* close */ | |
63 audiodb_close(mydbp); | |
64 | |
65 | |
66 | |
67 return(returnval); | |
68 } | 21 } |
69 | 22 |