]> git.donarmstrong.com Git - lilypond.git/blob - flower/test-file.cc
*** empty log message ***
[lilypond.git] / flower / test-file.cc
1 #define HAVE_BOOST_LAMBDA 1
2 #include "std-vector.hh"
3
4 #include <iostream>
5
6 #include <boost/test/auto_unit_test.hpp>
7 #include <boost/test/floating_point_comparison.hpp>
8
9 using namespace std;
10 using boost::unit_test::test_suite;
11
12 #include "file-name.hh"
13 string slashify (string file_name);
14
15 // FIXME
16 //BOOST_AUTO_UNIT_TEST (mingw_slashify)
17 void mingw_slashify ()
18 {
19   File_name f = string ("foe.ly");
20   string s = slashify (f.to_string ());
21   cout << s << endl;
22   BOOST_CHECK_EQUAL (s, "foe.ly");
23   f = string ("/tmp/x.ly");
24   s = slashify (f.to_string ());
25   cout << s << endl;
26   BOOST_CHECK_EQUAL (s, "/tmp/x.ly");
27   f = string ("c:/tmp/x.ly");
28   s = slashify (f.to_string ());
29   cout << s << endl;
30   BOOST_CHECK_EQUAL (s, "c:/tmp/x.ly");
31   f = string ("\\tmp\\x.ly");
32   s = slashify (f.to_string ());
33   cout << s << endl;
34   BOOST_CHECK_EQUAL (s, "/tmp/x.ly");
35 }
36
37 #include "config.hh"
38 #include "file-path.hh"
39
40 // FIXME
41 //BOOST_AUTO_UNIT_TEST (mingw_slashify)
42 void file_find ()
43 {
44   char const *extensions[] = {"ly", "", 0};
45   string file = "init";
46   File_path path;
47   char cwd[PATH_MAX];
48   getcwd (cwd, PATH_MAX);
49   string ly_dir = string (getenv ("LILYPONDPREFIX")) + "/ly";
50   cout << ly_dir << endl;
51   path.parse_path (string (1, PATHSEP) + ly_dir);
52   string file_name = path.find (file, extensions);
53   cout << file_name << endl;
54   BOOST_CHECK_EQUAL (file_name.substr (file_name.rfind ('/')), "/init.ly");
55   file = "init.ly";
56   file_name = path.find (file, extensions);
57   cout << file_name << endl;
58   BOOST_CHECK_EQUAL (file_name, ly_dir + "/init.ly");
59 }