From 0b94e5518f3859ba10697f34978122d8e3adb334 Mon Sep 17 00:00:00 2001 From: ak1 Date: Sun, 27 Feb 2005 10:54:18 +0000 Subject: [PATCH] Andreas Krennmair: removed the test suite, as it causes troubles with automake. git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@99 e385b8ad-14ed-0310-8656-cc95a2468c6d --- Makefile.am | 2 +- Makefile.in | 4 +- configure | 3 +- configure.in | 2 +- test/Makefile.am | 7 - test/Makefile.in | 414 --------------------------------------------- test/test_muttng.c | 122 ------------- test/test_muttng.h | 13 -- 8 files changed, 5 insertions(+), 562 deletions(-) delete mode 100644 test/Makefile.am delete mode 100644 test/Makefile.in delete mode 100644 test/test_muttng.c delete mode 100644 test/test_muttng.h diff --git a/Makefile.am b/Makefile.am index 60bff95..2c7e37e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ IMAP_SUBDIR = imap IMAP_INCLUDES = -I$(top_srcdir)/imap endif -SUBDIRS = m4 po intl doc contrib test $(IMAP_SUBDIR) +SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) bin_SCRIPTS = muttngbug fleang diff --git a/Makefile.in b/Makefile.in index c77e18b..19f47b4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -194,7 +194,7 @@ EXTRA_PROGRAMS = muttng_dotlock pgpringng pgpewrapng makedoc @BUILD_IMAP_TRUE@IMAP_SUBDIR = imap @BUILD_IMAP_TRUE@IMAP_INCLUDES = -I$(top_srcdir)/imap -SUBDIRS = m4 po intl doc contrib test $(IMAP_SUBDIR) +SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR) bin_SCRIPTS = muttngbug fleang @@ -351,7 +351,7 @@ DIST_COMMON = README ABOUT-NLS ChangeLog INSTALL Makefile.am \ config.guess config.h.in config.sub configure configure.in \ depcomp install-sh missing mkinstalldirs muttbug.sh.in regex.c \ snprintf.c strcasecmp.c strdup.c -DIST_SUBDIRS = m4 po intl doc contrib test imap +DIST_SUBDIRS = m4 po intl doc contrib imap SOURCES = $(makedoc_SOURCES) $(muttng_SOURCES) $(EXTRA_muttng_SOURCES) $(muttng_dotlock_SOURCES) $(pgpewrapng_SOURCES) $(pgpringng_SOURCES) all: $(BUILT_SOURCES) config.h diff --git a/configure b/configure index 1868ec2..ec5ce42 100755 --- a/configure +++ b/configure @@ -16821,7 +16821,7 @@ _ACEOF fi - ac_config_files="$ac_config_files Makefile intl/Makefile m4/Makefile po/Makefile.in doc/Makefile contrib/Makefile test/Makefile muttbug.sh imap/Makefile Muttngrc.head doc/instdoc.sh" + ac_config_files="$ac_config_files Makefile intl/Makefile m4/Makefile po/Makefile.in doc/Makefile contrib/Makefile muttbug.sh imap/Makefile Muttngrc.head doc/instdoc.sh" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -17412,7 +17412,6 @@ do "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "contrib/Makefile" ) CONFIG_FILES="$CONFIG_FILES contrib/Makefile" ;; - "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "muttbug.sh" ) CONFIG_FILES="$CONFIG_FILES muttbug.sh" ;; "imap/Makefile" ) CONFIG_FILES="$CONFIG_FILES imap/Makefile" ;; "Muttngrc.head" ) CONFIG_FILES="$CONFIG_FILES Muttngrc.head" ;; diff --git a/configure.in b/configure.in index 3514472..3f9cba1 100644 --- a/configure.in +++ b/configure.in @@ -1114,7 +1114,7 @@ fi dnl -- end libesmtp -- AC_OUTPUT(Makefile intl/Makefile m4/Makefile - po/Makefile.in doc/Makefile contrib/Makefile test/Makefile + po/Makefile.in doc/Makefile contrib/Makefile muttbug.sh imap/Makefile Muttngrc.head diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index f669d00..0000000 --- a/test/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -# mutt-ng test suite - -noinst_PROGRAMS=test_muttng -test_muttng_SOURCES= test_muttng.c ../lib.c -test_muttng_INCLUDES= @CFLAGS@ test_muttng.h -I../ -INCLUDES = -I$(top_srcdir) -test_muttng_LIBS= @LIBS@ diff --git a/test/Makefile.in b/test/Makefile.in deleted file mode 100644 index 147eace..0000000 --- a/test/Makefile.in +++ /dev/null @@ -1,414 +0,0 @@ -# Makefile.in generated by automake 1.7.6 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 -# Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# mutt-ng test suite - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_triplet = @host@ -ACLOCAL = @ACLOCAL@ -ALLOCA = @ALLOCA@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BUILD_IMAP_FALSE = @BUILD_IMAP_FALSE@ -BUILD_IMAP_TRUE = @BUILD_IMAP_TRUE@ -BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ -CATALOGS = @CATALOGS@ -CATOBJEXT = @CATOBJEXT@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DATADIRNAME = @DATADIRNAME@ -DBX = @DBX@ -DEBUGGER = @DEBUGGER@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DOTLOCK_GROUP = @DOTLOCK_GROUP@ -DOTLOCK_PERMISSION = @DOTLOCK_PERMISSION@ -DOTLOCK_TARGET = @DOTLOCK_TARGET@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -GDB = @GDB@ -GENCAT = @GENCAT@ -GLIBC21 = @GLIBC21@ -GMOFILES = @GMOFILES@ -GMSGFMT = @GMSGFMT@ -GPGME_CONFIG = @GPGME_CONFIG@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INSTOBJEXT = @INSTOBJEXT@ -INTLBISON = @INTLBISON@ -INTLLIBS = @INTLLIBS@ -INTLOBJS = @INTLOBJS@ -INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -ISPELL = @ISPELL@ -KRB5CFGPATH = @KRB5CFGPATH@ -LDFLAGS = @LDFLAGS@ -LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@ -LIBGNUTLS_CONFIG = @LIBGNUTLS_CONFIG@ -LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@ -LIBGPGME_CFLAGS = @LIBGPGME_CFLAGS@ -LIBGPGME_LIBS = @LIBGPGME_LIBS@ -LIBICONV = @LIBICONV@ -LIBIMAP = @LIBIMAP@ -LIBIMAPDEPS = @LIBIMAPDEPS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKINSTALLDIRS = @MKINSTALLDIRS@ -MSGFMT = @MSGFMT@ -MUTTLIBS = @MUTTLIBS@ -MUTT_LIB_OBJECTS = @MUTT_LIB_OBJECTS@ -OBJEXT = @OBJEXT@ -OPS = @OPS@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PGPAUX_TARGET = @PGPAUX_TARGET@ -POFILES = @POFILES@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -SDB = @SDB@ -SENDMAIL = @SENDMAIL@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SMIMEAUX_TARGET = @SMIMEAUX_TARGET@ -STRIP = @STRIP@ -SUBVERSION = @SUBVERSION@ -U = @U@ -USE_GSS_FALSE = @USE_GSS_FALSE@ -USE_GSS_TRUE = @USE_GSS_TRUE@ -USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ -USE_NLS = @USE_NLS@ -USE_SASL_FALSE = @USE_SASL_FALSE@ -USE_SASL_TRUE = @USE_SASL_TRUE@ -USE_SSL_FALSE = @USE_SSL_FALSE@ -USE_SSL_TRUE = @USE_SSL_TRUE@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -docdir = @docdir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mutt_libesmtp_config_path = @mutt_libesmtp_config_path@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ - -noinst_PROGRAMS = test_muttng -test_muttng_SOURCES = test_muttng.c ../lib.c -test_muttng_INCLUDES = @CFLAGS@ test_muttng.h -I../ -test_muttng_LIBS = @LIBS@ -subdir = test -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -noinst_PROGRAMS = test_muttng$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) - -am_test_muttng_OBJECTS = test_muttng.$(OBJEXT) lib.$(OBJEXT) -test_muttng_OBJECTS = $(am_test_muttng_OBJECTS) -test_muttng_LDADD = $(LDADD) -test_muttng_DEPENDENCIES = -test_muttng_LDFLAGS = - -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -depcomp = -am__depfiles_maybe = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_SOURCES = $(test_muttng_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(test_muttng_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps test/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) - -clean-noinstPROGRAMS: - -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) -test_muttng$(EXEEXT): $(test_muttng_OBJECTS) $(test_muttng_DEPENDENCIES) - @rm -f test_muttng$(EXEEXT) - $(LINK) $(test_muttng_LDFLAGS) $(test_muttng_OBJECTS) $(test_muttng_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -.c.o: - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: - $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi` - -lib.o: ../lib.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib.o `test -f '../lib.c' || echo '$(srcdir)/'`../lib.c - -lib.obj: ../lib.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lib.obj `if test -f '../lib.c'; then $(CYGPATH_W) '../lib.c'; else $(CYGPATH_W) '$(srcdir)/../lib.c'; fi` -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -CTAGS = ctags -CTAGSFLAGS = - -tags: TAGS - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique - -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) - -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-noinstPROGRAMS ctags distclean distclean-compile \ - distclean-generic distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-data install-data-am \ - install-exec install-exec-am install-info install-info-am \ - install-man install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ - ps ps-am tags uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/test/test_muttng.c b/test/test_muttng.c deleted file mode 100644 index 4f1f95a..0000000 --- a/test/test_muttng.c +++ /dev/null @@ -1,122 +0,0 @@ -/* based on MinUnit */ -#include -#include -#include "test_muttng.h" - -#include - -int tests_run = 0; -int asserts_run = 0; - -/* XXXXXXXXXXXXXXXXXXXXX */ -/* the following things are only here to satisfy the linker */ -int Umask; -void (*mutt_error) (const char *, ...); -const char * gettext(const char * a) { return a; } -void mutt_exit(int i) { exit(i); } -/* XXXXXXXXXXXXXXXXXXXX */ - - -/* tests the basic functions in lib.c */ -static char * test_lib(void) { - /* first check whether allocating 0 bytes behaves correctly */ - mu_assert("safe_malloc(0)!=NULL",safe_malloc(0)==NULL); - mu_assert("safe_calloc(0,0)!=NULL",safe_calloc(0,0)==NULL); - mu_assert("safe_calloc(1,0)!=NULL",safe_calloc(1,0)==NULL); - mu_assert("safe_calloc(0,1)!=NULL",safe_calloc(0,1)==NULL); - - /* check whether safe_malloc()/safe_free work correctly */ - { - char * ptr; - ptr = safe_malloc(1); - mu_assert("safe_malloc(1)==NULL",ptr!=NULL); - safe_free(&ptr); - mu_assert("ptr!=NULL",ptr==NULL); - } - - /* check whether safe_strdup works correctly */ - { - char * ptr; - mu_assert("safe_strdup(NULL)!=NULL",safe_strdup(NULL)==NULL); - mu_assert("safe_strdup("")!=NULL",safe_strdup("")==NULL); - ptr = safe_strdup("teststring"); - mu_assert("safe_strdup(\"teststring\")!=\"teststring\"",strcmp(ptr,"teststring")==0); - safe_free(&ptr); - - } - - /* check whether safe_strcat works correctly */ - { - char buf[16] = { 0 }; - safe_strcat(buf,sizeof(buf),"asdf"); - mu_assert("buf != \"asdf\"",strcmp(buf,"asdf")==0); - safe_strcat(buf,sizeof(buf),"qwer"); - mu_assert("buf != \"asdfqwer\"",strcmp(buf,"asdfqwer")==0); - safe_strcat(buf,sizeof(buf),"0123456789"); - mu_assert("buf != \"asdfqwer0123456\"",strcmp(buf,"asdfqwer0123456")==0); - safe_strcat(buf,sizeof(buf),"trash"); - mu_assert("buf != \"asdfqwer0123456\" (2)",strcmp(buf,"asdfqwer0123456")==0); - } - - /* check whether safe_strncat works correctly */ - { - char buf[16] = { 0 }; - safe_strncat(buf,sizeof(buf),"asdf",3); - mu_assert("buf != \"asd\"",strcmp(buf,"asd")==0); - safe_strncat(buf,sizeof(buf),"fghj",3); - mu_assert("buf != \"asdfgh\"",strcmp(buf,"asdfgh")==0); - safe_strncat(buf,sizeof(buf),"",10); - mu_assert("buf != \"asdfgh\" (2)",strcmp(buf,"asdfgh")==0); - safe_strncat(buf,sizeof(buf),"qwertzuiopyxcvvbnm",255); - mu_assert("buf != \"asdfghqwertzuio\"",strcmp(buf,"asdfghqwertzuio")==0); - } - - /* check whether mutt_str_replace works correctly */ - { - char * ptr = NULL; - mutt_str_replace(&ptr,"foobar"); - mu_assert("ptr != \"foobar\"",strcmp(ptr,"foobar")==0); - mutt_str_replace(&ptr,"quux"); - mu_assert("ptr != \"quux\"",strcmp(ptr,"quux")==0); - mutt_str_replace(&ptr,NULL); - mu_assert("ptr != NULL",ptr==NULL); - } - - /* check whether mutt_str_adjust works correctly */ - { - char * ptr = safe_strdup("some teststring"); - mutt_str_adjust(&ptr); - mu_assert("ptr != \"some teststring\"",strcmp(ptr,"some teststring")==0); - safe_free(&ptr); - } - - /* check whether mutt_strlower works correctly */ - { - char * supposed_result = "all you need is love"; - char * ptr = safe_strdup("ALL YOU NEED IS LOVE"); - mu_assert("ptr != \"all you need is love\"",strcmp(mutt_strlower(ptr),supposed_result)==0); - mutt_str_replace(&ptr,"All You Need Is LovE"); - mu_assert("ptr != \"all you need is love\" (2)",strcmp(mutt_strlower(ptr),supposed_result)==0); - mutt_str_replace(&ptr,"all you need is love"); - mu_assert("ptr != \"all you need is love\" (3)",strcmp(mutt_strlower(ptr),supposed_result)==0); - safe_free(&ptr); - } - - return 0; -} - -static char * all_tests(void) { - mu_run_test(test_lib); - return 0; -} - -int main(int argc, char **argv) { - char *result = all_tests(); - if (result != 0) { - printf("ERROR: %s\n", result); - } else { - printf("ALL TESTS PASSED\n"); - } - printf("Tests run: %d\nAssertions checked: %d\n", tests_run,asserts_run); - return result != 0; -} diff --git a/test/test_muttng.h b/test/test_muttng.h deleted file mode 100644 index 5d70316..0000000 --- a/test/test_muttng.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef TEST_MUTTNG__H - -#define mu_assert(message, test) do { asserts_run++; if (!(test)) return message; } while (0) -#define mu_run_test(test) do { char *message = test(); \ - tests_run++; \ - if (message) { \ - return message; \ - } \ - } while (0) -extern int tests_run; -extern int asserts_run; - -#endif -- 2.20.1