Make x.0.10 publicly available
[ACE_TAO.git] / ACE / tests / Compiler_Features_03_Test.cpp
blob9363c33759326df645d2cac9751a523b4b121d3a
1 /**
2 * @file
4 * This program checks if the compiler / platform supports the
5 * std::vector 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 <vector>
18 int
19 run_main (int, ACE_TCHAR *[])
21 ACE_START_TEST (ACE_TEXT("Compiler_Features_03_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 list ...
28 using collection = std::vector<int>;
29 collection c;
31 // ... insert some elements ...
32 c.push_back(5);
33 c.push_back(4);
34 c.push_back(3);
35 c.push_back(2);
36 c.push_back(1);
38 // ... add all the numbers to validate that they are there ...
39 int sum = 0;
40 for(collection::iterator i = c.begin(), end = c.end();
41 i != end;
42 ++i)
44 sum += *i;
47 // ... remember Euler ...
48 int const expected = 5*(5+1)/2;
49 if (sum != expected)
51 status = 1;
52 ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"),
53 expected, sum));
56 ACE_END_TEST;
57 return status;