diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 17 | ||||
-rw-r--r-- | tests/Makefile.in | 468 | ||||
-rw-r--r-- | tests/align.c | 205 | ||||
-rw-r--r-- | tests/chksum.c | 104 | ||||
-rw-r--r-- | tests/promote.c | 70 | ||||
-rw-r--r-- | tests/sizes.c | 133 |
6 files changed, 997 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am new file mode 100644 index 0000000..08246b3 --- /dev/null +++ b/tests/Makefile.am @@ -0,0 +1,17 @@ +## Process this file with automake to create Makefile.in +# +# Copyright (C) 1996-2008 Markus F.X.J. Oberhumer +# + +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir) + +noinst_PROGRAMS = align chksum promote sizes + +align_SOURCES = align.c +chksum_SOURCES = chksum.c +promote_SOURCES = promote.c +sizes_SOURCES = sizes.c + +align_LDADD = ../src/liblzo2.la +chksum_LDADD = ../src/liblzo2.la + diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..d86aa1f --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,468 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 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@ + +# +# Copyright (C) 1996-2008 Markus F.X.J. Oberhumer +# + +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 = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +noinst_PROGRAMS = align$(EXEEXT) chksum$(EXEEXT) promote$(EXEEXT) \ + sizes$(EXEEXT) +subdir = tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/autoconf/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_align_OBJECTS = align.$(OBJEXT) +align_OBJECTS = $(am_align_OBJECTS) +align_DEPENDENCIES = ../src/liblzo2.la +am_chksum_OBJECTS = chksum.$(OBJEXT) +chksum_OBJECTS = $(am_chksum_OBJECTS) +chksum_DEPENDENCIES = ../src/liblzo2.la +am_promote_OBJECTS = promote.$(OBJEXT) +promote_OBJECTS = $(am_promote_OBJECTS) +promote_LDADD = $(LDADD) +am_sizes_OBJECTS = sizes.$(OBJEXT) +sizes_OBJECTS = $(am_sizes_OBJECTS) +sizes_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/autoconf/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(align_SOURCES) $(chksum_SOURCES) $(promote_SOURCES) \ + $(sizes_SOURCES) +DIST_SOURCES = $(align_SOURCES) $(chksum_SOURCES) $(promote_SOURCES) \ + $(sizes_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +LZO_ASM_VPATH = @LZO_ASM_VPATH@ +LZO_CFLAGS = @LZO_CFLAGS@ +LZO_CPPFLAGS = @LZO_CPPFLAGS@ +LZO_EXTRA_CFLAGS = @LZO_EXTRA_CFLAGS@ +LZO_EXTRA_CPPFLAGS = @LZO_EXTRA_CPPFLAGS@ +LZO_USE_ASM_FALSE = @LZO_USE_ASM_FALSE@ +LZO_USE_ASM_TRUE = @LZO_USE_ASM_TRUE@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +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@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +configure_CFLAGS = @configure_CFLAGS@ +configure_CPPFLAGS = @configure_CPPFLAGS@ +datadir = @datadir@ +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@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir) +align_SOURCES = align.c +chksum_SOURCES = chksum.c +promote_SOURCES = promote.c +sizes_SOURCES = sizes.c +align_LDADD = ../src/liblzo2.la +chksum_LDADD = ../src/liblzo2.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +align$(EXEEXT): $(align_OBJECTS) $(align_DEPENDENCIES) + @rm -f align$(EXEEXT) + $(LINK) $(align_LDFLAGS) $(align_OBJECTS) $(align_LDADD) $(LIBS) +chksum$(EXEEXT): $(chksum_OBJECTS) $(chksum_DEPENDENCIES) + @rm -f chksum$(EXEEXT) + $(LINK) $(chksum_LDFLAGS) $(chksum_OBJECTS) $(chksum_LDADD) $(LIBS) +promote$(EXEEXT): $(promote_OBJECTS) $(promote_DEPENDENCIES) + @rm -f promote$(EXEEXT) + $(LINK) $(promote_LDFLAGS) $(promote_OBJECTS) $(promote_LDADD) $(LIBS) +sizes$(EXEEXT): $(sizes_OBJECTS) $(sizes_DEPENDENCIES) + @rm -f sizes$(EXEEXT) + $(LINK) $(sizes_LDFLAGS) $(sizes_OBJECTS) $(sizes_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/align.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chksum.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/promote.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sizes.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +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: TAGS + +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; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +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 + +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"; \ + $(mkdir_p) "$(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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-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 + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +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-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-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 mostlyclean-libtool \ + 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/tests/align.c b/tests/align.c new file mode 100644 index 0000000..1b2c540 --- /dev/null +++ b/tests/align.c @@ -0,0 +1,205 @@ +/* align.c -- test alignment (important for 16-bit systems) + + This file is part of the LZO real-time data compression library. + + Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library 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. + + The LZO 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + <markus@oberhumer.com> + http://www.oberhumer.com/opensource/lzo/ + */ + + +#if 0 +#include "src/lzo_conf.h" +#include "src/lzo_ptr.h" +#endif +#include "lzo/lzoconf.h" + +/* utility layer */ +#define WANT_LZO_MALLOC 1 +#include "examples/portab.h" + + +int opt_verbose = 0; + + +/************************************************************************* +// +**************************************************************************/ + +long align_test(lzo_bytep block, lzo_uint len, lzo_uint step) +{ + lzo_bytep b1 = block; + lzo_bytep b2 = block; + lzo_bytep k1 = NULL; + lzo_bytep k2 = NULL; + lzo_bytep k; + lzo_bytep x; + lzo_uint offset = 0; + long i = 0; + + assert(step > 0); + assert(step <= 65536L); + assert((step & (step - 1)) == 0); + + for (offset = step; offset < len; offset += step) + { + k1 = LZO_PTR_ALIGN_UP(b1+1,step); + k2 = b2 + offset; + if (k1 != k2) + { + printf("error 1: i %ld step %ld offset %ld: " + "%p (%ld) %p (%ld)\n", + i, (long) step, (long) offset, + k1, (long) (k1 - block), + k2, (long) (k2 - block)); + return 0; + } + if (k1 - step != b1) + { + printf("error 2: i %ld step %ld offset %ld: " + "%p (%ld) %p (%ld)\n", + i, (long) step, (long) offset, + b1, (long) (b1 - block), + k1, (long) (k1 - block)); + return 0; + } + + assert(k1 > b1); + assert(k2 > b2); + assert((lzo_uint)(k2 - b2) == offset); + assert(k1 - offset == b2); +#if defined(PTR_ALIGNED_4) + if (step == 4) + { + assert(PTR_ALIGNED_4(k1)); + assert(PTR_ALIGNED_4(k2)); + assert(PTR_ALIGNED2_4(k1,k2)); + } +#endif +#if defined(PTR_ALIGNED_8) + if (step == 8) + { + assert(PTR_ALIGNED_8(k1)); + assert(PTR_ALIGNED_8(k2)); + assert(PTR_ALIGNED2_8(k1,k2)); + } +#endif +#if defined(PTR_LINEAR) + assert((PTR_LINEAR(k1) & (step-1)) == 0); + assert((PTR_LINEAR(k2) & (step-1)) == 0); +#endif + + for (k = b1 + 1; k <= k1; k++) + { + x = LZO_PTR_ALIGN_UP(k,step); + if (x != k1) + { + printf("error 3: base: %p %p %p i %ld step %ld offset %ld: " + "%p (%ld) %p (%ld) %p (%ld)\n", + block, b1, b2, + i, (long) step, (long) offset, + k1, (long) (k1 - block), + k, (long) (k - block), + x, (long) (x - block)); + return 0; + } + } + + b1 = k1; + i++; + } + + return i; +} + + +/************************************************************************* +// +**************************************************************************/ + +#define BLOCK_LEN (128*1024L) + +int main(int argc, char *argv[]) +{ + lzo_bytep buf; + lzo_uint step; + + if (argc >= 2 && strcmp(argv[1],"-v") == 0) + opt_verbose = 1; + + if (lzo_init() != LZO_E_OK) + { + printf("lzo_init() failed !!!\n"); + return 3; + } + buf = (lzo_bytep) lzo_malloc(2*BLOCK_LEN + 256); + if (buf == NULL) + { + printf("out of memory\n"); + return 2; + } + + printf("Align init: %p ( 0x%lx )\n", buf, (unsigned long) buf); + + for (step = 1; step <= 65536L; step *= 2) + { + lzo_bytep block = buf; + long n; + unsigned gap; + + gap = __lzo_align_gap(block,step); + block = LZO_PTR_ALIGN_UP(block,step); + if (opt_verbose >= 1) + printf("STEP %5ld: GAP: %5lu %p %p %5ld\n", + (long) step, (long) gap, buf, block, + (long) (block - buf)); + n = align_test(block,BLOCK_LEN,step); + if (n == 0) + return 1; + if ((n + 1) * step != BLOCK_LEN) + { + printf("error 4: %ld %ld\n",(long)step,n); + return 1; + } + } + + lzo_free(buf); + printf("Alignment test passed.\n"); + return 0; +} + + +/* +vi:ts=4:et +*/ + diff --git a/tests/chksum.c b/tests/chksum.c new file mode 100644 index 0000000..89b6df1 --- /dev/null +++ b/tests/chksum.c @@ -0,0 +1,104 @@ +/* chksum.c -- compute a checksum + + This file is part of the LZO real-time data compression library. + + Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library 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. + + The LZO 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + <markus@oberhumer.com> + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "lzo/lzoconf.h" + +/* utility layer */ +#define WANT_LZO_MALLOC 1 +#include "examples/portab.h" + + +/************************************************************************* +// +**************************************************************************/ + +int main(int argc, char *argv[]) +{ + lzo_bytep block; + lzo_uint block_len; + lzo_uint32 adler, crc; + + if (argc < 0 && argv == NULL) /* avoid warning about unused args */ + return 0; + + if (lzo_init() != LZO_E_OK) + { + printf("lzo_init() failed !!!\n"); + return 4; + } + +/* prepare the block */ + block_len = 128 * 1024L; + block = (lzo_bytep) lzo_malloc(block_len); + if (block == NULL) + { + printf("out of memory\n"); + return 3; + } + lzo_memset(block, 0, block_len); + +/* adler32 checksum */ + adler = lzo_adler32(0, NULL, 0); + adler = lzo_adler32(adler, block, block_len); + if (adler != 0x001e0001UL) + { + printf("adler32 checksum error !!! (0x%08lx)\n", (long) adler); + return 2; + } + +/* crc32 checksum */ + crc = lzo_crc32(0, NULL, 0); + crc = lzo_crc32(crc, block, block_len); + if (crc != 0x7ee8cdcdUL) + { + printf("crc32 checksum error !!! (0x%08lx)\n", (long) crc); + return 1; + } + + lzo_free(block); + printf("Checksum test passed.\n"); + return 0; +} + + +/* +vi:ts=4:et +*/ + diff --git a/tests/promote.c b/tests/promote.c new file mode 100644 index 0000000..185bcc6 --- /dev/null +++ b/tests/promote.c @@ -0,0 +1,70 @@ +/* promote.c -- test intergral promotion + + This file is part of the LZO real-time data compression library. + + Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library 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. + + The LZO 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + <markus@oberhumer.com> + http://www.oberhumer.com/opensource/lzo/ + */ + +#include <stdio.h> + +int main(int argc, char *argv[]) +{ + unsigned char c; + int s; + + if (argc < 0 && argv == NULL) /* avoid warning about unused args */ + return 0; + + c = (unsigned char) (1 << (8 * sizeof(char) - 1)); + s = 8 * (int) (sizeof(int) - sizeof(char)); + + printf("Integral promotion: "); + if ((c << s) > 0) + { + printf("Classic C (unsigned-preserving)\n"); + printf("%d %d %uU\n", c, s, c << s); + return 1; + } + else + { + printf("ANSI C (value-preserving)\n"); + printf("%d %d %d\n", c, s, c << s); + return 0; + } +} + +/* +vi:ts=4:et +*/ diff --git a/tests/sizes.c b/tests/sizes.c new file mode 100644 index 0000000..fc04b2b --- /dev/null +++ b/tests/sizes.c @@ -0,0 +1,133 @@ +/* sizes.c -- print sizes of various types + + This file is part of the LZO real-time data compression library. + + Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer + All Rights Reserved. + + The LZO library 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. + + The LZO 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the LZO library; see the file COPYING. + If not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Markus F.X.J. Oberhumer + <markus@oberhumer.com> + http://www.oberhumer.com/opensource/lzo/ + */ + + +#include "lzo/lzoconf.h" +#include <stdio.h> + + +union _lzo_align1_t +{ + char a_char; +}; + +struct _lzo_align2_t +{ + char a_char; +}; + +struct _lzo_align3_t +{ + char a_char; + long a_long; +}; + +struct _lzo_align4_t +{ + char a_char; + char * a_char_p; +}; + +struct _lzo_align5_t +{ + char a_char1; + long a_long; + char a_char2; + char * a_char_p; +}; + +union _lzo_align6_t +{ + char a_char; + long a_long; + char * a_char_p; + lzo_bytep a_lzobytep; +}; + + +#define print_size(type) \ + sprintf(s,"sizeof(%s)",#type); \ + printf("%-30s %2d\n", s, (int)sizeof(type)); + +#define print_ssize(type,m) \ + sprintf(s,"sizeof(%s)",#type); \ + printf("%-30s %2d %20ld\n", s, (int)sizeof(type), (long)(m)); + +#define print_usize(type,m) \ + sprintf(s,"sizeof(%s)",#type); \ + printf("%-30s %2d %20lu\n", s, (int)sizeof(type), (unsigned long)(m)); + + +int main(int argc, char *argv[]) +{ + char s[80]; + + print_ssize(char,CHAR_MAX); + print_usize(unsigned char,UCHAR_MAX); + print_ssize(short,SHRT_MAX); + print_usize(unsigned short,USHRT_MAX); + print_ssize(int,INT_MAX); + print_usize(unsigned int,UINT_MAX); + print_ssize(long,LONG_MAX); + print_usize(unsigned long,ULONG_MAX); + printf("\n"); + print_size(char *); + print_size(void (*)(void)); + printf("\n"); + print_ssize(lzo_int,LZO_INT_MAX); + print_usize(lzo_uint,LZO_UINT_MAX); + print_usize(lzo_uint32,LZO_UINT32_MAX); + print_size(lzo_bytep); + printf("\n"); + print_size(union _lzo_align1_t); + print_size(struct _lzo_align2_t); + print_size(struct _lzo_align3_t); + print_size(struct _lzo_align4_t); + print_size(struct _lzo_align5_t); + print_size(union _lzo_align6_t); + + if (argc < 0 && argv == NULL) /* avoid warning about unused args */ + return 0; + return 0; +} + +/* +vi:ts=4:et +*/ + |