+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.
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
--- /dev/null
+#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");
+}
#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
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**)
{
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;
}
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