annotate libtests/0003/prog1.c @ 369:6564be3109c5 gcc-4.3-cleanups

gcc-4.3 warning cleanups for lshlib.cpp (I do not believe that any of these changes contain significant copyrightable "intellectual property". However, to the extent that they do, the changes are hereby released into the Public Domain, and may be therefore be used by anyone for any purpose without need for consideration of any kind.)
author mas01cr
date Wed, 12 Nov 2008 15:23:32 +0000
parents 94c18f128ce8
children e072aa1611f5 342822c2d49a
rev   line source
mas01ik@355 1 #include <stdio.h>
mas01ik@355 2 #include <stdlib.h>
mas01ik@355 3 #include <string.h>
mas01ik@355 4 #include <sysexits.h>
mas01ik@355 5 #include <fcntl.h>
mas01ik@355 6 #include <dirent.h>
mas01ik@355 7 #include <unistd.h>
mas01ik@355 8 #include <sys/stat.h>
mas01ik@355 9 /*
mas01ik@355 10 * * #define NDEBUG
mas01ik@355 11 * * */
mas01ik@355 12 #include <assert.h>
mas01ik@355 13
mas01ik@355 14 #include "../../audioDB_API.h"
mas01ik@355 15 #include "../test_utils_lib.h"
mas01ik@355 16
mas01ik@355 17
mas01ik@355 18 int main(int argc, char **argv){
mas01ik@355 19
mas01ik@355 20 int returnval=0;
mas01ik@355 21 adb_ptr mydbp={0};
mas01ik@355 22 int ivals[10]={0};
mas01ik@355 23 double dvals[10]={0.0};
mas01ik@355 24 adb_insert_t myinsert={0};
mas01ik@355 25 unsigned int myerr=0;
mas01ik@355 26 adb_query_t myadbquery={0};
mas01ik@355 27 adb_queryresult_t myadbqueryresult={0};
mas01ik@355 28 char * databasename="testdb";
mas01ik@355 29 int size=0;
mas01ik@355 30
mas01ik@355 31
mas01ik@355 32 /* remove old directory */
mas01ik@355 33 //if [ -f testdb ]; then rm -f testdb; fi
mas01ik@355 34 //
mas01ik@355 35 clean_remove_db(databasename);
mas01ik@355 36
mas01ik@355 37
mas01ik@355 38 /* create new db */
mas01ik@355 39 //${AUDIODB} -d testdb -N
mas01ik@355 40 mydbp=audiodb_create(databasename,0,0,0);
mas01ik@355 41
mas01ik@355 42 /* turn on l2norm */
mas01ik@355 43 //# point query now implemented as sequence search
mas01ik@355 44 //${AUDIODB} -d testdb -L
mas01ik@355 45 audiodb_l2norm(mydbp);
mas01ik@355 46
mas01ik@355 47 /* make a test file */
mas01ik@355 48 //# FIXME: endianness!
mas01ik@355 49 //intstring 1 > testfeature
mas01ik@355 50 //floatstring 1 >> testfeature
mas01ik@355 51 ivals[0]=1;
mas01ik@355 52 dvals[0]=1;
mas01ik@355 53 maketestfile("testfeature",ivals,dvals,1);
mas01ik@355 54
mas01ik@355 55 /* insert */
mas01ik@355 56 //${AUDIODB} -d testdb -I -f testfeature
mas01ik@355 57 myinsert.features="testfeature";
mas01ik@355 58 myerr=audiodb_insert(mydbp,&myinsert);
mas01ik@355 59
mas01ik@355 60 /* query */
mas01ik@355 61 //${AUDIODB} -d testdb -Q point -f testfeature > test-query-output
mas01ik@355 62 myadbquery.querytype="point";
mas01ik@355 63 myadbquery.feature="testfeature";
mas01ik@355 64 audiodb_query(mydbp,&myadbquery,&myadbqueryresult);
mas01ik@355 65
mas01ik@355 66 /* check the test values */
mas01ik@355 67 //echo testfeature 1 0 0 > test-expected-query-output
mas01ik@355 68 //cmp test-query-output test-expected-query-output
mas01ik@355 69 size=myadbqueryresult.sizeRlist;
mas01ik@355 70 if (size != 1) {returnval = -1;};
mas01ik@355 71 if (testoneresult(&myadbqueryresult,0,"testfeature",1,0,0)) {returnval = -1;};
mas01ik@355 72
mas01ik@355 73
mas01ik@355 74 //#
mas01ik@355 75 //## failure cases
mas01ik@355 76 //expect_clean_error_exit ${AUDIODB} -d testdb -I
mas01ik@355 77 //expect_clean_error_exit ${AUDIODB} -d testdb -f testfeature
mas01ik@355 78 //expect_clean_error_exit ${AUDIODB} -I -f testfeature
mas01ik@355 79 //expect_clean_error_exit ${AUDIODB} -d testdb -Q notpoint -f testfeature
mas01ik@355 80 //expect_clean_error_exit ${AUDIODB} -Q point -f testfeature
mas01ik@355 81 /* all of these will fail at compile time because of API */
mas01ik@355 82
mas01ik@355 83 audiodb_close(mydbp);
mas01ik@355 84
mas01ik@355 85 return(returnval);
mas01ik@355 86 }
mas01ik@355 87
mas01ik@355 88
mas01ik@355 89
mas01ik@355 90
mas01ik@355 91