Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / tests / Compiler_Features_05_Test.cpp
blobc67992ba4a34efe43f2254c8258adea80ec9c5b8
1 /**
2 * @file
4 * This program checks if the compiler / platform supports the
5 * std::queue container. The motivation for this test was a discussion
6 * on the development mailing queue, and the documentation was captured
7 * in:
9 * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715
12 #include "test_config.h"
14 // The first part of the test is to compile this line. If the program
15 // does not compile the platform is just too broken.
16 #include <queue>
18 int
19 run_main (int, ACE_TCHAR *[])
21 ACE_START_TEST (ACE_TEXT("Compiler_Features_05_Test"));
23 // As usual, the exit status from the test is 0 on success, 1 on
24 // failure
25 int status = 0;
27 // Create a simple queue ...
28 using collection = std::queue<int>;
29 // ... if the previous line compiles, the default template
30 // parameters work. The declaration of queue<> is something like:
31 // template<typename T, typename Sequence = deque<T> >
32 // notice that this is not a template template parameter...
33 collection c;
35 // ... insert some elements ...
36 c.push(5);
37 c.push(4);
38 c.push(3);
39 c.push(2);
40 c.push(1);
42 // ... add all the numbers to validate that they are there ...
43 int sum = 0;
44 while (! c.empty())
46 sum += c.front();
47 c.pop();
50 // ... remember Euler ...
51 int const expected = 5*(5+1)/2;
52 if (sum != expected)
54 status = 1;
55 ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"),
56 expected, sum));
59 ACE_END_TEST;
60 return status;