diff options
author | Erik de Castro Lopo <erikd@miles> | 2005-05-17 12:47:23 +0000 |
---|---|---|
committer | Erik de Castro Lopo <erikd@miles> | 2005-05-17 12:47:23 +0000 |
commit | cdc45c6121987ac3a49280ae11ba38be0d1c57fd (patch) | |
tree | b1513adbf8c009949f33347fcd70c2f584b77d01 /regtest | |
parent | 5675ac1897fe3ae31586a14d7dec4da20f0a042e (diff) |
Final integration of regtest code.
Diffstat (limited to 'regtest')
-rw-r--r-- | regtest/Makefile.am | 5 | ||||
-rw-r--r-- | regtest/checksum.c | 12 | ||||
-rw-r--r-- | regtest/database.c | 5 | ||||
-rw-r--r-- | regtest/database.h | 41 | ||||
-rw-r--r-- | regtest/regtest.c | 114 | ||||
-rw-r--r-- | regtest/sndfile-regtest.c | 14 |
6 files changed, 13 insertions, 178 deletions
diff --git a/regtest/Makefile.am b/regtest/Makefile.am index 839142d..ad53986 100644 --- a/regtest/Makefile.am +++ b/regtest/Makefile.am @@ -2,7 +2,10 @@ bin_PROGRAMS = sndfile-regtest -noinst_HEADERS = database.h +noinst_HEADERS = regtest.h + +SNDFILEDIR =../src +INCLUDES = -I$(srcdir)/$(SNDFILEDIR) $(OS_SPECIFIC_CFLAGS) sndfile_regtest_SOURCES = sndfile-regtest.c database.c checksum.c sndfile_regtest_LDADD = $(SNDFILEDIR)/libsndfile.la $(SQLITE3_LIBS) diff --git a/regtest/checksum.c b/regtest/checksum.c index 853d684..033a156 100644 --- a/regtest/checksum.c +++ b/regtest/checksum.c @@ -20,18 +20,18 @@ ** A simple checksum for short, int and float data. */ +#include "config.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> -#define _ISOC9X_SOURCE 1 -#define _ISOC99_SOURCE 1 -#define __USE_ISOC9X 1 -#define __USE_ISOC99 1 -#include <math.h> - #include <sndfile.h> +#include "float_cast.h" + +#include "regtest.h" + #define BIG_PRIME 999983 #define ARRAY_LEN(x) ((int) (sizeof (x)) / (sizeof ((x) [0]))) diff --git a/regtest/database.c b/regtest/database.c index fd02e1c..71ccbbc 100644 --- a/regtest/database.c +++ b/regtest/database.c @@ -27,7 +27,7 @@ #include <sndfile.h> -#include "database.h" +#include "regtest.h" typedef struct { sqlite3 *sql ; @@ -84,7 +84,8 @@ db_open (const char * db_name) int db_create (const char * db_name) { REGTEST_DB * db ; - char * errmsg = NULL, *cmd ; + const char *cmd ; + char * errmsg = NULL ; int err ; db = (REGTEST_DB *) db_open (db_name) ; diff --git a/regtest/database.h b/regtest/database.h deleted file mode 100644 index 6d6694a..0000000 --- a/regtest/database.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -** Copyright (C) 2005 Erik de Castro Lopo -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -typedef struct REG_DB_tag REG_DB ; - -REG_DB * db_open (const char * db_name) ; - -int db_create (const char * dbname) ; - -int db_close (REG_DB * db_handle) ; - -int db_file_exists (REG_DB * db_handle, const char * filename) ; -int db_add_file (REG_DB * db_handle, const char * filename) ; -int db_check_file (REG_DB * db_handle, const char * filename) ; - -int db_list_all (REG_DB * db_handle) ; -int db_check_all (REG_DB * db_handle) ; -int db_del_entry (REG_DB * db_handle, const char * entry) ; - -/* -** Do not edit or modify anything in this comment block. -** The following line is a file identity tag for the GNU Arch -** revision control system. -** -** arch-tag: 80138e38-f373-48d3-8152-7f7882a62cd7 -*/ diff --git a/regtest/regtest.c b/regtest/regtest.c deleted file mode 100644 index debf633..0000000 --- a/regtest/regtest.c +++ /dev/null @@ -1,114 +0,0 @@ -/* -** Copyright (C) 2005 Erik de Castro Lopo -** -** This program is free software; you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation; either version 2 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program; if not, write to the Free Software -** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <sndfile.h> - -#include "database.h" - -enum -{ OPT_ADD_FILE = 0x0100, - OPT_CREATE_DB = 0x0200, - OPT_DEL_ENTRY = 0x0400, - OPT_LIST_ALL = 0x0800, - OPT_TEST_ALL = 0x1000, - OPT_VERBOSE = 0x2000 -} ; - -static void print_libsndfile_version (void) ; - -int -main (int argc, char * argv []) -{ static char *db_name = "./.sndfile-regtest.db" ; - REG_DB *reg_db ; - int k, retval ; - - if (argc < 2) - { printf ("\nUsage message goes here.\n\n") ; - exit (0) ; - } ; - - if (argc == 2 && strcmp (argv [1], "--create-db") == 0) - return db_create (db_name) ; - - reg_db = db_open (db_name) ; - - if (argc == 2) - { if (strcmp (argv [1], "--list-all") == 0) - return db_list_all (reg_db) ; - - if (strcmp (argv [1], "--check-all") == 0) - { print_libsndfile_version () ; - retval = db_check_all (reg_db) ; - puts ("\nDone.\n") ; - return retval ; - } ; - } ; - - if (argc == 3 && strcmp (argv [1], "--del-entry") == 0) - { db_del_entry (reg_db, argv [2]) ; - db_close (reg_db) ; - return 0 ; - } ; - - if (strcmp (argv [1], "--check-file") == 0) - { print_libsndfile_version () ; - - for (k = 2 ; k < argc ; k++) - db_check_file (reg_db, argv [k]) ; - db_close (reg_db) ; - return 0 ; - } ; - - if (strcmp (argv [1], "--add-file") == 0) - { print_libsndfile_version () ; - - for (k = 2 ; k < argc ; k++) - db_add_file (reg_db, argv [k]) ; - db_close (reg_db) ; - return 0 ; - } ; - - printf ("\nError : unhandled command line args :") ; - for (k = 1 ; k < argc ; k++) - printf (" %s", argv [k]) ; - puts ("\n") ; - - return 1 ; -} /* main */ - -static void -print_libsndfile_version (void) -{ char version [64] ; - - sf_command (NULL, SFC_GET_LIB_VERSION, version, sizeof (version)) ; - printf ("\nsndfile-regtest : using %s\n\n", version) ; -} /* print_lib_version */ - - - -/* -** Do not edit or modify anything in this comment block. -** The following line is a file identity tag for the GNU Arch -** revision control system. -** -** arch-tag: 7f318f08-9bfa-4249-856d-fe994819bdce -*/ diff --git a/regtest/sndfile-regtest.c b/regtest/sndfile-regtest.c index ee7eaa9..65aa076 100644 --- a/regtest/sndfile-regtest.c +++ b/regtest/sndfile-regtest.c @@ -16,16 +16,12 @@ ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "config.h" - #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sndfile.h> -#if HAVE_SQLITE3 - #include "regtest.h" enum @@ -107,17 +103,7 @@ print_libsndfile_version (void) printf ("\nsndfile-regtest : using %s\n\n", version) ; } /* print_lib_version */ -#else - -int -main (void) -{ - puts ("\nThis program was not compiled with libsqlite3 and hence doesn't work.\n") ; - - return 0 ; -} /* main */ -#endif /* ** Do not edit or modify anything in this comment block. |