Mercurial > hg > audiodb
annotate libtests/0002/prog1.c @ 487:e072aa1611f5 api-inversion
Begin cleaning up libtests
* Delete unused functions from test_utils_lib.h.
* #include needed system header files there rather than at the head of
each of the individual C files.
* Make libtests.mk be responsible for finding audioDB_API.h and
test_utils_lib.h
* Simplify the implementation of clean_remove_db().
author | mas01cr |
---|---|
date | Sat, 10 Jan 2009 15:32:42 +0000 |
parents | 94c18f128ce8 |
children | 4cb6c611f812 |
rev | line source |
---|---|
mas01cr@487 | 1 #include "audioDB_API.h" |
mas01cr@487 | 2 #include "test_utils_lib.h" |
mas01ik@355 | 3 |
mas01ik@355 | 4 |
mas01ik@355 | 5 int main(int argc, char **argv){ |
mas01ik@355 | 6 |
mas01ik@355 | 7 int returnval=0; |
mas01ik@355 | 8 adb_ptr mydbp={0}; |
mas01ik@355 | 9 adb_status_t mystatus={0}; |
mas01ik@355 | 10 |
mas01ik@355 | 11 char * databasename="testdb"; |
mas01ik@355 | 12 |
mas01ik@355 | 13 //. ../test-utils.sh |
mas01ik@355 | 14 // |
mas01ik@355 | 15 //if [ -f testdb ]; then rm -f testdb; fi |
mas01ik@355 | 16 // |
mas01ik@355 | 17 /* remove old directory */ |
mas01ik@355 | 18 clean_remove_db(databasename); |
mas01ik@355 | 19 |
mas01ik@355 | 20 /* create new db */ |
mas01ik@355 | 21 //${AUDIODB} -N -d testdb |
mas01ik@355 | 22 // |
mas01ik@355 | 23 mydbp=audiodb_create(databasename,0,0,0); |
mas01ik@355 | 24 |
mas01ik@355 | 25 |
mas01ik@355 | 26 //# FIXME: at some point we will want to test that some relevant |
mas01ik@355 | 27 //# information is being printed |
mas01ik@355 | 28 //${AUDIODB} -S -d testdb |
mas01ik@355 | 29 //${AUDIODB} -d testdb -S |
mas01ik@355 | 30 |
mas01ik@355 | 31 if(audiodb_status(mydbp,&mystatus)){ |
mas01ik@355 | 32 returnval=-1; |
mas01ik@355 | 33 } |
mas01ik@355 | 34 |
mas01ik@355 | 35 /* not relevent, caught by API */ |
mas01ik@355 | 36 //# should fail (no db given) |
mas01ik@355 | 37 //expect_clean_error_exit ${AUDIODB} -S |
mas01ik@355 | 38 |
mas01ik@355 | 39 |
mas01ik@355 | 40 |
mas01ik@355 | 41 audiodb_close(mydbp); |
mas01ik@355 | 42 |
mas01ik@355 | 43 return(returnval); |
mas01ik@355 | 44 } |
mas01ik@355 | 45 |