Mercurial > hg > audiodb
annotate libtests/0002/prog1.c @ 469:d3afc91d205d api-inversion
Move audioDB::query over to audioDB.cpp
At the same time, remove all the abstraction violations in
audioDB::query, which came in two flavours: use of dbH->numFiles, which
is dealt with by getting the database status instead (and is eventually
unnecessary, being only needed now because reporters are implemented in
terms of vectors indexed by ID), and use of fileTable in reporter's
report functions (dealt with by passing in the adb instead).
To actually implement reporting as of now, we continue to use stuff from
audioDB-internals.h; maybe someday we will be clean and shiny.
author | mas01cr |
---|---|
date | Wed, 31 Dec 2008 15:44:16 +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 adb_status_t mystatus={0}; |
mas01ik@355 | 23 |
mas01ik@355 | 24 char * databasename="testdb"; |
mas01ik@355 | 25 |
mas01ik@355 | 26 //. ../test-utils.sh |
mas01ik@355 | 27 // |
mas01ik@355 | 28 //if [ -f testdb ]; then rm -f testdb; fi |
mas01ik@355 | 29 // |
mas01ik@355 | 30 /* remove old directory */ |
mas01ik@355 | 31 clean_remove_db(databasename); |
mas01ik@355 | 32 |
mas01ik@355 | 33 /* create new db */ |
mas01ik@355 | 34 //${AUDIODB} -N -d testdb |
mas01ik@355 | 35 // |
mas01ik@355 | 36 mydbp=audiodb_create(databasename,0,0,0); |
mas01ik@355 | 37 |
mas01ik@355 | 38 |
mas01ik@355 | 39 //# FIXME: at some point we will want to test that some relevant |
mas01ik@355 | 40 //# information is being printed |
mas01ik@355 | 41 //${AUDIODB} -S -d testdb |
mas01ik@355 | 42 //${AUDIODB} -d testdb -S |
mas01ik@355 | 43 |
mas01ik@355 | 44 if(audiodb_status(mydbp,&mystatus)){ |
mas01ik@355 | 45 returnval=-1; |
mas01ik@355 | 46 } |
mas01ik@355 | 47 |
mas01ik@355 | 48 /* not relevent, caught by API */ |
mas01ik@355 | 49 //# should fail (no db given) |
mas01ik@355 | 50 //expect_clean_error_exit ${AUDIODB} -S |
mas01ik@355 | 51 |
mas01ik@355 | 52 |
mas01ik@355 | 53 |
mas01ik@355 | 54 audiodb_close(mydbp); |
mas01ik@355 | 55 |
mas01ik@355 | 56 return(returnval); |
mas01ik@355 | 57 } |
mas01ik@355 | 58 |