From a26c1338d1a399ba16f27a6f37b2ccd461aaa59d Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Thu, 16 Feb 2006 12:51:46 +0000 Subject: [PATCH] *** empty log message *** --- ChangeLog | 9 +++++ flower/GNUmakefile | 4 +++ flower/test-file.cc | 59 ++++++++++++++++++++++++++++++++ flower/test-std.cc | 33 ++++++++++++++++-- stepmake/stepmake/test-vars.make | 4 ++- 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 flower/test-file.cc diff --git a/ChangeLog b/ChangeLog index 154c294cc3..5a57030827 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-02-16 Jan Nieuwenhuizen + + * flower/test-file.cc: New file. + + * stepmake/stepmake/test-vars.make (TEST_MODULE_LIBES): Fixes for + libraries. + + * flower/GNUmakefile (TEST_MODULE_LIBS): Link to flower lib. + 2006-02-16 Han-Wen Nienhuys * flower/include/file-storage.hh: remove file. diff --git a/flower/GNUmakefile b/flower/GNUmakefile index d8ea4bddfc..5fe94f1f08 100644 --- a/flower/GNUmakefile +++ b/flower/GNUmakefile @@ -9,4 +9,8 @@ README_FILES = NEWS-1.0 NEWS-1.1.46 README TODO EXTRA_DIST_FILES= VERSION $(README_FILES) $(SCRIPTS) STEPMAKE_TEMPLATES=library c++ po test +# test uses LILYPONDPREFIX +LOCALSTEPMAKE_TEMPLATES=lilypond +TEST_MODULE_LIBS = ../flower + include $(depth)/make/stepmake.make diff --git a/flower/test-file.cc b/flower/test-file.cc new file mode 100644 index 0000000000..564f81e30e --- /dev/null +++ b/flower/test-file.cc @@ -0,0 +1,59 @@ +#define HAVE_BOOST_LAMBDA 1 +#include "std-vector.hh" + +#include + +#include +#include + +using namespace std; +using boost::unit_test::test_suite; + +#include "file-name.hh" +string slashify (string file_name); + +// FIXME +//BOOST_AUTO_UNIT_TEST (mingw_slashify) +void mingw_slashify () +{ + File_name f = string ("foe.ly"); + string s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "foe.ly"); + f = string ("/tmp/x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); + f = string ("c:/tmp/x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "c:/tmp/x.ly"); + f = string ("\\tmp\\x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); +} + +#include "config.hh" +#include "file-path.hh" + +// FIXME +//BOOST_AUTO_UNIT_TEST (mingw_slashify) +void file_find () +{ + char const *extensions[] = {"ly", "", 0}; + string file = "init"; + File_path path; + char cwd[PATH_MAX]; + getcwd (cwd, PATH_MAX); + string ly_dir = string (getenv ("LILYPONDPREFIX")) + "/ly"; + cout << ly_dir << endl; + path.parse_path (string (1, PATHSEP) + ly_dir); + string file_name = path.find (file, extensions); + cout << file_name << endl; + BOOST_CHECK_EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly"); + file = "init.ly"; + file_name = path.find (file, extensions); + cout << file_name << endl; + BOOST_CHECK_EQUAL (file_name, ly_dir + "/init.ly"); +} diff --git a/flower/test-std.cc b/flower/test-std.cc index 4724f8f5ca..ebf212e29b 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -12,13 +12,12 @@ #include #include -using boost::unit_test::test_suite; - #if !STD_VECTOR #define vector flower_vector #endif using namespace std; +using boost::unit_test::test_suite; template void @@ -177,6 +176,34 @@ BOOST_AUTO_UNIT_TEST (vector_search) BOOST_CHECK_EQUAL (i, vsize (1)); } +#if 0 +#include "file-name.hh" +string slashify (string file_name); + +BOOST_AUTO_UNIT_TEST (mingw_slashify) +{ + File_name f = string ("foe.ly"); + string s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "foe.ly"); + f = string ("/tmp/x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); + f = string ("c:/tmp/x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "c:/tmp/x.ly"); + f = string ("\\tmp\\x.ly"); + s = slashify (f.to_string ()); + cout << s << endl; + BOOST_CHECK_EQUAL (s, "/tmp/x.ly"); +} +#endif + +void mingw_slashify (); +void file_find (); + test_suite* init_unit_test_suite (int, char**) { @@ -198,5 +225,7 @@ init_unit_test_suite (int, char**) test->add (BOOST_TEST_CASE (parray_concat)); test->add (BOOST_TEST_CASE (parray_uniq)); test->add (BOOST_TEST_CASE (vector_search)); + test->add (BOOST_TEST_CASE (mingw_slashify)); + test->add (BOOST_TEST_CASE (file_find)); return test; } diff --git a/stepmake/stepmake/test-vars.make b/stepmake/stepmake/test-vars.make index ffabc1bd29..97a1c6b443 100644 --- a/stepmake/stepmake/test-vars.make +++ b/stepmake/stepmake/test-vars.make @@ -2,4 +2,6 @@ TEST_O_FILES := $(filter $(outdir)/test%, $(O_FILES)) O_FILES := $(filter-out $(outdir)/test%, $(O_FILES)) TEST_EXECUTABLE = $(outdir)/test-$(NAME) -TEST_LOADLIBES = $(LOADLIBES) -lboost_unit_test_framework +TEST_MODULE_LIBES =$(addprefix $(outdir)/../, $(addsuffix /$(outbase)/library.a, $(TEST_MODULE_LIBS))) + +TEST_LOADLIBES = $(TEST_MODULE_LIBES) $(LOADLIBES) -lboost_unit_test_framework -- 2.39.2