From 855a337e54321d9aa2b97c38ffa4787d3105257c Mon Sep 17 00:00:00 2001 From: mananth Date: Fri, 29 Aug 2003 10:14:55 +0000 Subject: Removing dlist_test.c from version earlier than 0_2_0 --- test/Makefile.am | 4 - test/Makefile.in | 316 ------------------------------------------------------ test/dlist_test.c | 273 ---------------------------------------------- 3 files changed, 593 deletions(-) delete mode 100644 test/Makefile.am delete mode 100644 test/Makefile.in delete mode 100644 test/dlist_test.c diff --git a/test/Makefile.am b/test/Makefile.am deleted file mode 100644 index 25a4881..0000000 --- a/test/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -bin_PROGRAMS = dlist_test -dlist_test_SOURCES = dlist_test.c -INCLUDES = -I../include -LDADD = ../lib/libsysfs.a diff --git a/test/Makefile.in b/test/Makefile.in deleted file mode 100644 index fb046a8..0000000 --- a/test/Makefile.in +++ /dev/null @@ -1,316 +0,0 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. -# @configure_input@ - -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# 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@ -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_HEADER = $(INSTALL_DATA) -transform = @program_transform_name@ -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -AMTAR = @AMTAR@ -AWK = @AWK@ -CC = @CC@ -DEPDIR = @DEPDIR@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -STRIP = @STRIP@ -VERSION = @VERSION@ -am__include = @am__include@ -am__quote = @am__quote@ -install_sh = @install_sh@ -bin_PROGRAMS = dlist_test -dlist_test_SOURCES = dlist_test.c -INCLUDES = -I../include -LDADD = ../lib/libsysfs.a -subdir = test -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = dlist_test$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) - -am_dlist_test_OBJECTS = dlist_test.$(OBJEXT) -dlist_test_OBJECTS = $(am_dlist_test_OBJECTS) -dlist_test_LDADD = $(LDADD) -dlist_test_DEPENDENCIES = ../lib/libsysfs.a -dlist_test_LDFLAGS = - -DEFS = @DEFS@ -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dlist_test.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ -DIST_SOURCES = $(dlist_test_SOURCES) -DIST_COMMON = Makefile.am Makefile.in -SOURCES = $(dlist_test_SOURCES) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu test/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ - done - -clean-binPROGRAMS: - -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -dlist_test$(EXEEXT): $(dlist_test_OBJECTS) $(dlist_test_DEPENDENCIES) - @rm -f dlist_test$(EXEEXT) - $(LINK) $(dlist_test_LDFLAGS) $(dlist_test_OBJECTS) $(dlist_test_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlist_test.Po@am__quote@ - -distclean-depend: - -rm -rf ./$(DEPDIR) - -.c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< - -.c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` -CCDEPMODE = @CCDEPMODE@ -uninstall-info-am: - -ETAGS = etags -ETAGSFLAGS = - -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 - -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 -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) - -distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ - 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: - $(mkinstalldirs) $(DESTDIR)$(bindir) - -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-binPROGRAMS clean-generic mostlyclean-am - -distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags - -dvi: dvi-am - -dvi-am: - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -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 - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic distclean distclean-compile distclean-depend \ - distclean-generic distclean-tags distdir dvi dvi-am info \ - info-am install install-am install-binPROGRAMS 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 tags uninstall uninstall-am \ - uninstall-binPROGRAMS 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/dlist_test.c b/test/dlist_test.c deleted file mode 100644 index 787df80..0000000 --- a/test/dlist_test.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * dlist_test.c - * - * Copyright (C) 2003 Eric J Bohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - - -/* Double linked list implementation tester. - */ -#include "dlist.h" -#include -#include -// create some dlists put nodes in and out -// use dump -// try list with del_func and without -// use insert, unshift, push -// use pop push mark -// use prev next - -typedef struct simple { - char label[80]; - int number; -} Simple; - - -typedef struct complex { - int cnumber; - Simple *sthing; -} Complex; - -void complex_silly_multiply_by_two( void *a); -int complex_equal(void *a, void *b); -int complex_less(void *a, void *b); -int complex_greater(void *a, void *b); -void simple_dump(Dlist *); -void simple_dump_rev(Dlist *); -void complex_dump(Dlist *); -void complex_out(void *); -void complex_del(void *); -Complex *complex_maker(int,int,char *); - -Simple *simple_maker(int ,char *); - -int main (int argc,char *argv[]) -{ - Dlist *list; - Simple *s1,*s2,*s3,*stemp; - Complex *c1,*c2,*c3, *ctemp, *cfound; - while(1) - { - s1=simple_maker(1,"one"); - s2=simple_maker(2,"two"); - s3=simple_maker(3,"three"); - if((list=dlist_new(sizeof(Simple)))==NULL) - { - fprintf(stderr,"ERR dlist_new fail\n"); - return(2); - } - dlist_push(list,s1); - dlist_push(list,s2); - dlist_push(list,s3); - printf("count is %ld\n",list->count); - simple_dump(list); - simple_dump_rev(list); - stemp=dlist_pop(list); - printf("popped %s\n",stemp->label); - simple_dump(list); - printf("pushed\n"); - dlist_push(list,s3); - simple_dump(list); - stemp=dlist_shift(list); - printf("shifted %s\n",stemp->label); - simple_dump(list); - printf("unshifted\n"); - dlist_unshift(list,stemp); - simple_dump(list); - dlist_destroy(list); - c1=complex_maker(1,1,"one"); - c2=complex_maker(2,2,"two"); - c3=complex_maker(3,3,"three"); - if((list=dlist_new_with_delete(sizeof(Complex),complex_del))==NULL) - { - fprintf(stderr,"ERR dlist_new fail\n"); - return(2); - } - if(dlist_insert_sorted(list,c1,complex_less)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - printf("sorted insert 1\n"); - if(dlist_insert_sorted(list,c3,complex_less)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - if(dlist_insert_sorted(list,c2,complex_less)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - printf("sorted insert 2\n"); - printf("ascending sorted output\n"); - complex_dump(list); - dlist_transform(list,complex_silly_multiply_by_two); - printf("transform multi by 2 output\n"); - complex_dump(list); - ctemp=complex_maker(6,6,"three"); - if((cfound=(Complex *) dlist_find_custom(list,ctemp,complex_equal))!=NULL) - - { - printf("found %d as %d in list\n",ctemp->cnumber,cfound->cnumber); - } else { - printf("ERROR find failed on %d \n",ctemp->cnumber); - return(3); - } - complex_del(ctemp); - dlist_destroy(list); - c1=complex_maker(1,1,"one"); - c2=complex_maker(2,2,"two"); - c3=complex_maker(3,3,"three"); - if((list=dlist_new_with_delete(sizeof(Complex),complex_del))==NULL) - { - fprintf(stderr,"ERR dlist_new fail\n"); - return(2); - } - if(dlist_insert_sorted(list,c1,complex_greater)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - printf("greater sorted insert 1\n"); - if(dlist_insert_sorted(list,c3,complex_greater)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - printf("greater sorted insert 3\n"); - if(dlist_insert_sorted(list,c2,complex_greater)==NULL) - { - fprintf(stderr,"ERR dlist_insert fail\n"); - return(2); - } - printf("greater sorted insert 2\n"); - printf("descending sorted output using transform\n"); - dlist_transform(list,complex_out); - dlist_destroy(list); - } - return(0); -} - -void simple_dump (Dlist *list) -{ - Simple *thisone; - printf("count %ld \n",list->count); - dlist_for_each_data(list,thisone,Simple) - { - printf("label %s number %d \n",thisone->label,thisone->number); - } - -} -void simple_dump_rev (Dlist *list) -{ - Simple *thisone; - printf("rev count %ld \n",list->count); - dlist_for_each_data_rev(list,thisone,Simple) - { - printf("label %s number %d \n",thisone->label,thisone->number); - } -} - -Simple * simple_maker(int snumber,char *label) -{ - Simple *stemp; - if((stemp=malloc(sizeof(Simple)))==NULL) - { - fprintf(stderr,"ERR malloc fail\n"); - return(NULL); - } - stemp->number=snumber; - strcpy(stemp->label,label); - return(stemp); -} - -Complex * complex_maker(int cnumber, int snumber, char* label) -{ - Complex *ctemp; - if((ctemp=malloc(sizeof(Complex)))==NULL) - { - fprintf(stderr,"ERR malloc fail\n"); - return(NULL); - } - ctemp->cnumber=cnumber; - ctemp->sthing=simple_maker(snumber,label); - return(ctemp); -} - -void complex_out(void *data) -{ - Complex *thisone=(Complex *)data; - printf("cnumber %d label %s number %d \n",thisone->cnumber,thisone->sthing->label,thisone->sthing->number); -} - -/** - * return 1 if a==b, else 0 - */ -int complex_equal(void *a, void *b) -{ - if((((Complex *)a)->cnumber==((Complex *)b)->cnumber) - && (((Complex *)a)->sthing->number== - ((Complex *)b)->sthing->number) - && strcmp(((Complex *)a)->sthing->label, - ((Complex *)b)->sthing->label)==0) - return(1); - return(0); -} - -/** for sorting - * return 1 if acnumber < ((Complex *)b)->cnumber ); -} - -/** for sorting - * return 1 if a>b, else 0 - */ -int complex_greater(void *a, void *b) -{ - return( ((Complex *)a)->cnumber > ((Complex *)b)->cnumber ); -} - -void complex_silly_multiply_by_two( void *a) -{ - ((Complex *)a)->cnumber=((Complex *)a)->cnumber*2; - ((Complex *)a)->sthing->number=((Complex *)a)->sthing->number*2; -} - -void complex_dump (Dlist *list) -{ - Complex *thisone; - dlist_start(list); - printf("count %ld \n",list->count); - dlist_for_each_data(list,thisone,Complex) - { - printf("cnumber %d label %s number %d \n",thisone->cnumber,thisone->sthing->label,thisone->sthing->number); - } - -} - -void complex_del (void *item) -{ - Complex *corpse=item; - printf("freeing complex\n"); - free(corpse->sthing); - free(corpse); -} -- cgit v1.2.1