From: Jan Nieuwenhuizen Date: Wed, 1 Feb 2006 23:59:50 +0000 (+0000) Subject: * flower/include/std-vector.hh (slice): Remove. X-Git-Tag: release/2.7.31~25 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=745e083b855d3072661ff9b04b8519f6b03e0e9a;p=lilypond.git * flower/include/std-vector.hh (slice): Remove. (sort): Bugfix. * flower/test-std.cc (vector_sort): New test. --- diff --git a/ChangeLog b/ChangeLog index 14c7311b08..3e824bf447 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ 2006-02-02 Jan Nieuwenhuizen * flower/include/std-vector.hh (slice): Remove. + (sort): Bugfix. + + * flower/test-std.cc (vector_sort): New test. 2006-02-01 Graham Percival diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index e5920fee52..dd3f97e30f 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -163,13 +163,7 @@ namespace std { } void - sort (int vsize=VPOS, vsize b=VPOS, vsize e=VPOS) - { - ::std::sort (iter (b), iter(e)); - } - - void - sort (int (*compare) (T const &, T const &), int b=-1, int e=-1) + sort (int (*compare) (T const &, T const &), vsize b=0, int e=VPOS) { ::std::sort (iter (b), iter(e), compare); } diff --git a/flower/test-std.cc b/flower/test-std.cc index 1e3f0f125f..eeceaddb15 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -59,11 +59,25 @@ BOOST_AUTO_UNIT_TEST (vector_slice) #endif } +BOOST_AUTO_UNIT_TEST (vector_sort) +{ + vector v; + v.push_back (2); + v.push_back (1); + v.push_back (0); + v.sort (default_compare); + print (v); + BOOST_CHECK_EQUAL (v[0], 0); + BOOST_CHECK_EQUAL (v[1], 1); + BOOST_CHECK_EQUAL (v[2], 2); +} + test_suite* init_unit_test_suite (int, char**) { test_suite *test = BOOST_TEST_SUITE("std::Flower"); test->add (BOOST_TEST_CASE (vector_erase)); test->add (BOOST_TEST_CASE (vector_slice)); + test->add (BOOST_TEST_CASE (vector_sort)); return test; }