Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / tests / Compiler_Features_01_Test.cpp
blob75d5b7e5421c8e5d54f74efdad0ce1122a840d7a
1 /**
2 * @file
4 * This program checks if the compiler / platform supports the
5 * std::list container. The motivation for this test was a discussion
6 * on the development mailing list, 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 <list>
19 int
20 run_main (int, ACE_TCHAR *[])
22 ACE_START_TEST (ACE_TEXT("Compiler_Features_01_Test"));
24 // As usual, the exit status from the test is 0 on success, 1 on
25 // failure
26 int status = 0;
28 // Create a simple list ...
29 using collection = std::list<int>;
30 collection c;
32 // ... insert some elements ...
33 c.push_back(5);
34 c.push_back(4);
35 c.push_back(3);
36 c.push_back(2);
37 c.push_back(1);
39 // ... add all the numbers to validate that they are there ...
40 int sum = 0;
41 for(collection::iterator i = c.begin(), end = c.end();
42 i != end;
43 ++i)
45 sum += *i;
48 // ... remember Euler ...
49 int const expected = 5*(5+1)/2;
50 if (sum != expected)
52 status = 1;
53 ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"),
54 expected, sum));
57 ACE_END_TEST;
58 return status;