diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/Makefile.in | 55 | ||||
-rw-r--r-- | src/test/fst_test.h | 41 |
2 files changed, 70 insertions, 26 deletions
diff --git a/src/test/Makefile.in b/src/test/Makefile.in index 00fe859..f86a1e6 100644 --- a/src/test/Makefile.in +++ b/src/test/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @@ -39,10 +39,10 @@ TESTS = fst_test$(EXEEXT) weight_test$(EXEEXT) algo_test$(EXEEXT) subdir = src/test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_icu.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -112,6 +112,7 @@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -121,11 +122,6 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ -ICU_CFLAGS = @ICU_CFLAGS@ -ICU_CONFIG = @ICU_CONFIG@ -ICU_CPPFLAGS = @ICU_CPPFLAGS@ -ICU_CXXFLAGS = @ICU_CXXFLAGS@ -ICU_LIBS = @ICU_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -140,6 +136,7 @@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ @@ -165,6 +162,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -199,7 +197,6 @@ libexecdir = @libexecdir@ libfstdir = @libfstdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ @@ -263,13 +260,13 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -algo_test$(EXEEXT): $(algo_test_OBJECTS) $(algo_test_DEPENDENCIES) +algo_test$(EXEEXT): $(algo_test_OBJECTS) $(algo_test_DEPENDENCIES) $(EXTRA_algo_test_DEPENDENCIES) @rm -f algo_test$(EXEEXT) $(CXXLINK) $(algo_test_OBJECTS) $(algo_test_LDADD) $(LIBS) -fst_test$(EXEEXT): $(fst_test_OBJECTS) $(fst_test_DEPENDENCIES) +fst_test$(EXEEXT): $(fst_test_OBJECTS) $(fst_test_DEPENDENCIES) $(EXTRA_fst_test_DEPENDENCIES) @rm -f fst_test$(EXEEXT) $(CXXLINK) $(fst_test_OBJECTS) $(fst_test_LDADD) $(LIBS) -weight_test$(EXEEXT): $(weight_test_OBJECTS) $(weight_test_DEPENDENCIES) +weight_test$(EXEEXT): $(weight_test_OBJECTS) $(weight_test_DEPENDENCIES) $(EXTRA_weight_test_DEPENDENCIES) @rm -f weight_test$(EXEEXT) $(CXXLINK) $(weight_test_OBJECTS) $(weight_test_LDADD) $(LIBS) @@ -443,14 +440,15 @@ check-TESTS: $(TESTS) fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ - echo "$$grn$$dashes"; \ + col="$$grn"; \ else \ - echo "$$red$$dashes"; \ + col="$$red"; \ fi; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes$$std"; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi @@ -500,10 +498,15 @@ install-am: all-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 + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/src/test/fst_test.h b/src/test/fst_test.h index 8f9dca0..fdc9209 100644 --- a/src/test/fst_test.h +++ b/src/test/fst_test.h @@ -51,6 +51,8 @@ class FstTester { testfst_ = new F(vfst); } + explicit FstTester(F *testfst) : testfst_(testfst) { } + ~FstTester() { delete testfst_; } @@ -207,6 +209,7 @@ class FstTester { template <class G> void TestIO(const G &fst) const { const string filename = FLAGS_tmpdir + "/test.fst"; + const string aligned = FLAGS_tmpdir + "/aligned.fst"; { // write/read CHECK(fst.Write(filename)); @@ -232,6 +235,44 @@ class FstTester { delete hfst; } + { + // check mmaping by first writing the file with the aligned attribute set + { + ofstream ostr(aligned.c_str()); + FstWriteOptions opts; + opts.source = aligned; + opts.align = true; + CHECK(fst.Write(ostr, opts)); + } + ifstream istr(aligned.c_str()); + FstReadOptions opts; + opts.mode = FstReadOptions::ReadMode("map"); + opts.source = aligned; + G *gfst = G::Read(istr, opts); + CHECK(gfst); + TestBase(*gfst); + delete gfst; + } + + // check mmaping of unaligned files to make sure it does not fail. + { + { + ofstream ostr(aligned.c_str()); + FstWriteOptions opts; + opts.source = aligned; + opts.align = false; + CHECK(fst.Write(ostr, opts)); + } + ifstream istr(aligned.c_str()); + FstReadOptions opts; + opts.mode = FstReadOptions::ReadMode("map"); + opts.source = aligned; + G *gfst = G::Read(istr, opts); + CHECK(gfst); + TestBase(*gfst); + delete gfst; + } + // expanded write/read/test if (fst.Properties(kExpanded, false)) { ExpandedFst<Arc> *efst = ExpandedFst<Arc>::Read(filename); |