void test_sequence1 () {
	std::vector<int> v;

	v.clear ();
	test_sequence_no_comparison   ( v,                       v.end (), v.end ());	// No elements
	test_sequence_with_comparison ( v, std::greater<int> (), v.end (), v.end ());
	
	v.push_back ( 5 );
	test_sequence_no_comparison   ( v,                       v.begin (), v.end () - 1 );	// one element
	test_sequence_with_comparison ( v, std::greater<int> (), v.begin (), v.end () - 1 );
	v.push_back ( 5 );
	
	test_sequence_no_comparison   ( v,                       v.begin (), v.end () - 1 );	// two elements
	test_sequence_with_comparison ( v, std::greater<int> (), v.begin (), v.end () - 1 );
		
	v.clear ();
	for ( int i = 5; i < 15; ++i )
		v.push_back ( 10 );
	test_sequence_no_comparison   ( v,                       v.begin (), v.end () - 1 );	// even # of elements
	test_sequence_with_comparison ( v, std::greater<int> (), v.begin (), v.end () - 1 );
	
	v.clear ();
	for ( int i = 5; i < 16; ++i )
		v.push_back ( 9 );
	test_sequence_no_comparison   ( v,                       v.begin (), v.end () - 1 );	// odd # of elements
	test_sequence_with_comparison ( v, std::greater<int> (), v.begin (), v.end () - 1 );
	}
Example #2
0
void test_sequence1 () {
	std::vector<int> v;
	
	v.clear ();
	for ( int i = 5; i < 15; ++i )
		v.push_back ( i );
	test_sequence_no_comparison ( v, 5, 14 );	// even # of elements
	
	v.clear ();
	for ( int i = 5; i < 16; ++i )
		v.push_back ( i );
	test_sequence_no_comparison ( v, 5, 15 );	// odd # of elements

	}