X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=flower%2Ftest-std.cc;h=ed317f7f631a13c4850ed307118a859bb2d7c276;hb=d8dd51629ecaeaaaa37bfc882b18bada83637955;hp=e6f0da3d3e5f4c4dcafeafc36235550d47aee13c;hpb=6c68e65859bae109509e1c464fdfca6de4b5ddd1;p=lilypond.git diff --git a/flower/test-std.cc b/flower/test-std.cc index e6f0da3d3e..ed317f7f63 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -1,8 +1,9 @@ - +#define STD_VECTOR 1 #if !STD_VECTOR #define Array flower_vector #endif + #define HAVE_BOOST_LAMBDA 1 #include "std-vector.hh" @@ -11,13 +12,13 @@ #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; +using namespace boost::unit_test; template void @@ -84,7 +85,8 @@ BOOST_AUTO_UNIT_TEST (vector_sorting) #if VECTOR_SORT v.sort (default_compare); #else - vector_sort (v, default_compare); + //sort (v.begin (), v.end ()); + vector_sort (v, less ()); #endif BOOST_CHECK_EQUAL (v[0], 0); BOOST_CHECK_EQUAL (v[1], 1); @@ -161,7 +163,7 @@ BOOST_AUTO_UNIT_TEST (parray_uniq) v.push_back (0); v.push_back (1); v.push_back (0); - vector_sort (v, default_compare); + vector_sort (v, less ()); uniq (v); BOOST_CHECK_EQUAL (v.size (), vsize (2)); } @@ -172,24 +174,58 @@ BOOST_AUTO_UNIT_TEST (vector_search) v.push_back (0); v.push_back (1); v.push_back (2); - vsize i = binary_search (v, 1, &default_compare); + vsize i = binary_search (v, 1, less ()); 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 (); + +#include +#include +#include + test_suite* init_unit_test_suite (int, char**) { vsize i = 0; vsize j = 0; vector v; - binary_search_bounds (v, 1, &default_compare, &i, &j); + binary_search (v, 1, less (), i, j); //binary_search_bounds (v, 1, &default_compare, 0, 0); //Link_array w; vector w; - binary_search_bounds (w, (char*)1, &default_compare, &i, &j); + binary_search (w, (char*)1, less (), i, j); - test_suite *test = BOOST_TEST_SUITE("std::Flower"); + test_suite *test = BOOST_TEST_SUITE("Flower"); + + test->add (BOOST_TEST_CASE (vector_erase)); test->add (BOOST_TEST_CASE (vector_slice)); test->add (BOOST_TEST_CASE (vector_sorting)); @@ -197,5 +233,8 @@ 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; }