]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorjanneke <janneke>
Thu, 16 Feb 2006 12:51:46 +0000 (12:51 +0000)
committerjanneke <janneke>
Thu, 16 Feb 2006 12:51:46 +0000 (12:51 +0000)
ChangeLog
flower/GNUmakefile
flower/test-file.cc [new file with mode: 0644]
flower/test-std.cc
stepmake/stepmake/test-vars.make

index 154c294cc3797e10a8d8fee7430a85a4a86dce88..5a57030827802b3b63396565f11f1eb5e481137a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-16  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * 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  <hanwen@xs4all.nl>
 
        * flower/include/file-storage.hh: remove file.
index d8ea4bddfc8e33b9d5a72bea81138d0927f0cf41..5fe94f1f08c8bbf17368392ce9e91c2e49709d85 100644 (file)
@@ -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 (file)
index 0000000..564f81e
--- /dev/null
@@ -0,0 +1,59 @@
+#define HAVE_BOOST_LAMBDA 1
+#include "std-vector.hh"
+
+#include <iostream>
+
+#include <boost/test/auto_unit_test.hpp>
+#include <boost/test/floating_point_comparison.hpp>
+
+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");
+}
index 4724f8f5ca7431247f05c0c9189a1e650e1dfd9d..ebf212e29bcb90c64389302204f0309feaff0d83 100644 (file)
 #include <boost/test/auto_unit_test.hpp>
 #include <boost/test/floating_point_comparison.hpp>
 
-using boost::unit_test::test_suite;
-
 #if !STD_VECTOR
 #define vector flower_vector
 #endif
 
 using namespace std;
+using boost::unit_test::test_suite;
 
 template<typename T>
 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;
 }
index ffabc1bd2997de0a5d730ccd805186609e14a68c..97a1c6b443b1e9993caeebd08cf10e2e8737f389 100644 (file)
@@ -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