4 * This program checks if the compiler / platform supports alternative
5 * sorting functions in the std::set container. The motivation for
6 * this test was a discussion on the development mailing list, and the
7 * documentation was captured
10 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715
13 #include "test_config.h"
15 // The first part of the test is to compile this line. If the program
16 // does not compile the platform is just too broken.
19 // We are going to use std::greater<>, the spec requires us to include this
20 // header. Only a few platforms enforce this though...
24 run_main (int, ACE_TCHAR
*[])
26 ACE_START_TEST (ACE_TEXT("Compiler_Features_06_Test"));
28 // As usual, the exit status from the test is 0 on success, 1 on
32 // Create a simple list ...
33 using collection
= std::set
<int, std::greater
<int>>;
36 // ... insert some elements ...
43 // ... inserting twice returns a pair ...
44 std::pair
<collection::iterator
,bool> r
=
45 c
.insert(collection::value_type(5));
47 // ... the iterator points to the element ...
51 ACE_ERROR ((LM_ERROR
, ACE_TEXT("Expected to find 5 already in set")));
54 // ... and the booleans says that it is already in the set ...
58 ACE_ERROR ((LM_ERROR
, ACE_TEXT("Expected duplicate insert to fail")));
61 // ... make sure the first element is the biggest one ...
65 ACE_ERROR ((LM_ERROR
, ACE_TEXT("Expected largest element (5) at the front")));
68 // ... add all the numbers to validate that they are there ...
70 for(collection::iterator i
= c
.begin(), end
= c
.end();
77 // ... remember Euler ...
78 int const expected
= 5*(5+1)/2;
82 ACE_ERROR ((LM_ERROR
, ACE_TEXT("Expected %d got %d\n"),