void test_generic_set<ValueTraits, ContainerDefiner>::test_sort(std::vector<typename ValueTraits::value_type>& values) { typedef typename ValueTraits::value_type value_type; typedef typename ContainerDefiner < value_type , value_traits<ValueTraits> , constant_time_size<value_type::constant_time_size> >::type set_type; set_type testset1 (values.begin(), values.end()); { int init_values [] = { 1, 2, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } testset1.clear(); BOOST_TEST (testset1.empty()); typedef typename ValueTraits::value_type value_type; typedef typename ContainerDefiner < value_type , compare<even_odd> , value_traits<ValueTraits> , constant_time_size<value_type::constant_time_size> >::type set_type2; set_type2 testset2 (&values[0], &values[0] + 6); { int init_values [] = { 5, 3, 1, 4, 2 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset2.rbegin() ); } BOOST_TEST (testset2.begin()->value_ == 2); BOOST_TEST (testset2.rbegin()->value_ == 5); }
void test_generic_multiset<ValueTraits, ContainerDefiner>::test_sort(value_cont_type& values) { typedef typename ValueTraits::value_type value_type; typedef ContainerDefiner < value_type , value_traits<ValueTraits> , constant_time_size<value_type::constant_time_size> > definer_function; typedef typename definer_function::type multiset_type; multiset_type testset1 (values.begin(), values.end()); { int init_values [] = { 1, 2, 2, 3, 4, 5 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset1.begin() ); } testset1.clear(); BOOST_TEST (testset1.empty()); typedef ContainerDefiner < value_type , compare<even_odd> , value_traits<ValueTraits> , constant_time_size<value_type::constant_time_size> > definer_function2; typedef typename definer_function2::type multiset_type2; multiset_type2 testset2 (values.begin(), values.begin() + 6); { int init_values [] = { 5, 3, 1, 4, 2, 2 }; TEST_INTRUSIVE_SEQUENCE( init_values, testset2.rbegin() ); } BOOST_TEST (testset2.begin()->value_ == 2); BOOST_TEST (testset2.rbegin()->value_ == 5); }