changeset 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 b2fd8113d8bc
children f4dc8e47ee37
files libtests/0001/prog1.c libtests/0002/prog1.c libtests/0003/prog1.c libtests/0004/prog1.c libtests/0005/prog1.c libtests/0006/prog1.c libtests/0007/prog1.c libtests/0008/prog1.c libtests/0009/prog1.c libtests/0010/prog1.c libtests/0011/prog1.c libtests/0012/prog1.c libtests/0022/prog1.c libtests/0023/prog1.c libtests/0024/prog1.c libtests/0025/prog1.c libtests/0026/prog1.c libtests/0027/prog1.c libtests/0028/prog1.c libtests/0029/prog1.c libtests/0030/prog1.c libtests/0031/prog1.c libtests/0032/prog1.c libtests/0033/prog1.c libtests/0034/prog1.c libtests/0035/prog1.c libtests/0036/prog1.c libtests/0037/prog1.c libtests/9000/prog1.c libtests/libtest.mk libtests/test_utils_lib.h
diffstat 31 files changed, 73 insertions(+), 552 deletions(-) [+]
line wrap: on
line diff
--- a/libtests/0001/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0001/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,19 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <errno.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0002/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0002/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0003/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0003/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,19 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
-
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 int main(int argc, char **argv){
 
--- a/libtests/0004/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0004/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0005/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0005/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0006/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0006/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0007/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0007/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0008/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0008/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0009/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0009/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0010/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0010/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0011/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0011/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0012/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0012/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0022/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0022/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0023/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0023/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0024/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0024/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0025/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0025/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 void maketimesfile(char * filename);
 
--- a/libtests/0026/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0026/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0027/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0027/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0028/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0028/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0029/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0029/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0030/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0030/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0031/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0031/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0032/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0032/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0033/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0033/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0034/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0034/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0035/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0035/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0036/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0036/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/0037/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/0037/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 int result_position(adb_query_results_t *r, const char *key, float dist, uint32_t qpos, uint32_t ipos) {
   for(uint32_t k = 0; k < r->nresults; k++) {
--- a/libtests/9000/prog1.c	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/9000/prog1.c	Sat Jan 10 15:32:42 2009 +0000
@@ -1,18 +1,5 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sysexits.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/stat.h>
-/*
- *  * #define NDEBUG
- *   * */
-#include <assert.h>
-
-#include "../../audioDB_API.h"
-#include "../test_utils_lib.h"
+#include "audioDB_API.h"
+#include "test_utils_lib.h"
 
 
 int main(int argc, char **argv){
--- a/libtests/libtest.mk	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/libtest.mk	Sat Jan 10 15:32:42 2009 +0000
@@ -28,7 +28,7 @@
 	-ln -s $< $@
 
 test1: prog1.c ../test_utils_lib.h ../../audioDB_API.h
-	gcc -g -std=c99 -Wall $(ARCH_FLAGS) -laudioDB -L. -Wl,-rpath,. -o $@ $<
+	gcc -g -std=c99 -Wall $(ARCH_FLAGS) -I.. -I../.. -laudioDB -L. -Wl,-rpath,. -o $@ $<
 
 clean:
 	-rm $(LIBRARY_FULL) $(LIBRARY_VERS) $(LIBRARY)
--- a/libtests/test_utils_lib.h	Tue Jan 06 16:27:01 2009 +0000
+++ b/libtests/test_utils_lib.h	Sat Jan 10 15:32:42 2009 +0000
@@ -1,99 +1,20 @@
-void delete_dir(char * dirname);
-void clean_remove_db(char * dirname);
-void test_status(adb_ptr d, adb_status_ptr b);
-unsigned int test_insert( adb_ptr d, char * features, char * power, char * key);
-void dump_query(adb_query_ptr adbq, adb_queryresult_ptr myadbqueryresult);
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <math.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <stdio.h>
+
+void clean_remove_db(char *dbname);
 int testoneresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, double Dist,double Qpos,double Spos);
-double doubleabs(double foo);
 void maketestfile(char * filename, int * ivals, double * dvals, int dvalsize);
 int testoneradiusresult(adb_queryresult_ptr myadbqueryresult, int i, char * Rlist, int count);
 void makekeylistfile(char * filename, char * item);
 
 
-
-
-/* clean remove */
-void clean_remove_db(char * dbname){
-
-    FILE* db=0;
-
-    db=fopen(dbname,"r");
-
-    if (!db){
-        return;
-    }
-
-
-    fclose(db);
-    remove(dbname);
-
-    return;
-
-}
-
-
-/* delete directory */
-void delete_dir(char * dirname){
-
-    struct dirent *d;
-    DIR *dir;
-    char buf[256];
-
-    printf("Deleting directory '%s' and all files\n", dirname);
-    dir = opendir(dirname);
-
-    if (dir){
-        while((d = readdir(dir))) {
-            //printf("Deleting %s in %s\n",d->d_name, dirname);
-            sprintf(buf, "%s/%s", dirname, d->d_name);
-            remove(buf);
-        }
-    }
-    closedir(dir);
-
-    rmdir(dirname);
-
-
-    return;
-
-}
-
-
-unsigned int test_insert(
-    adb_ptr d,
-    char * features,
-    char * power,
-    char * key
-){
-
-    adb_insert_t myinsert={0};
-    unsigned int myerr=0;
-
-    printf("Insert:\n");
-    myinsert.features=features;
-    myinsert.power=power; 
-    myinsert.key=key; 
-    myerr=audiodb_insert(d,&myinsert); 
-    printf("\n");
-
-    return myerr;
-
-}
-
-void test_status(adb_ptr d, adb_status_ptr b){
-
-    /* get the status of the database */
-    audiodb_status(d,b);
-
-    /* could probably make this look a bit more clever, but it works for now */
-    printf("numFiles:\t%d\n",b->numFiles);
-    printf("dim:\t%d\n",b->dim);
-    printf("length:\t%d\n",b->length);
-    printf("dudCount:\t%d\n",b->dudCount);
-    printf("nullCount:\t%d\n",b->nullCount);
-    printf("flags:\t%d\n",b->flags);
-
-    return;
+void clean_remove_db(char * dbname) {
+  unlink(dbname);
 }
 
 
@@ -133,15 +54,15 @@
     } 
 
 
-    if (doubleabs((double)Dist - (double)myadbqueryresult->Dist[i]) > tolerance){
+    if (fabs((double)Dist - (double)myadbqueryresult->Dist[i]) > tolerance){
         ret=-1;
     } 
     
-    if (doubleabs((double)Qpos - (double)myadbqueryresult->Qpos[i]) > tolerance){
+    if (fabs((double)Qpos - (double)myadbqueryresult->Qpos[i]) > tolerance){
         ret=-1;
     } 
 
-    if (doubleabs((double)Spos - (double)myadbqueryresult->Spos[i]) > tolerance){
+    if (fabs((double)Spos - (double)myadbqueryresult->Spos[i]) > tolerance){
         ret=-1;
     } 
 
@@ -168,20 +89,6 @@
     return ret;
 }
 
-
-double doubleabs(double foo){
-
-    double retval=foo;
-
-    if (foo < 0.0) {
-        retval=foo * -1.0;
-    }
-
-    return retval;
-}
-
-
-
 void maketestfile(char * filename, int * ivals, double * dvals, int dvalsize) {
 
     FILE * myfile;
@@ -195,8 +102,6 @@
     /* should probably test for success, but then it is a test suite already... */
 }
 
-
-
 void makekeylistfile(char * filename, char * item){
 
     FILE * myfile;
@@ -207,8 +112,3 @@
     fclose(myfile);
 
 }
-
-
-
-
-