Mercurial > hg > audiodb
comparison libtests/0005/prog1.c @ 355:94c18f128ce8
First version of the API, committed to the main trunk. Thanks Christophe, for all the help!
author | mas01ik |
---|---|
date | Wed, 12 Nov 2008 10:21:06 +0000 |
parents | |
children | e072aa1611f5 342822c2d49a |
comparison
equal
deleted
inserted
replaced
354:4871a3ed9e36 | 355:94c18f128ce8 |
---|---|
1 #include <stdio.h> | |
2 #include <stdlib.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 | |
14 #include "../../audioDB_API.h" | |
15 #include "../test_utils_lib.h" | |
16 | |
17 | |
18 int main(int argc, char **argv){ | |
19 | |
20 int returnval=0; | |
21 adb_ptr mydbp={0}; | |
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 | |
29 | |
30 /* remove old directory */ | |
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 } | |
69 |