diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2013-10-27 15:37:41 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2013-10-27 15:37:41 +0000 |
commit | 6a07c02d40a24d1cfc214d4af19ad9c13654b67c (patch) | |
tree | bc789c81d82fb4f14d56a3461cb82ca7d0f6290a /ACE/tests/Compiler_Features_28_Test.cpp | |
parent | e5751476054868ec29cb0de10e4c3337b7c0673e (diff) | |
download | ATCD-6a07c02d40a24d1cfc214d4af19ad9c13654b67c.tar.gz |
Sun Oct 27 15:38:07 UTC 2013 Johnny Willemsen <jwillemsen@remedy.nl>
* tests/Compiler_Features_28_Test.cpp:
* tests/run_test.lst:
* tests/tests.mpc:
New C++11 test program
Diffstat (limited to 'ACE/tests/Compiler_Features_28_Test.cpp')
-rw-r--r-- | ACE/tests/Compiler_Features_28_Test.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ACE/tests/Compiler_Features_28_Test.cpp b/ACE/tests/Compiler_Features_28_Test.cpp new file mode 100644 index 00000000000..c82402e69a9 --- /dev/null +++ b/ACE/tests/Compiler_Features_28_Test.cpp @@ -0,0 +1,60 @@ +// $Id$ + +/** + * This program checks if the compiler doesn't have a certain bug + * that we encountered when testing C++11 features + */ + +#include "test_config.h" + +#if defined (ACE_HAS_CPP11) + +enum class OPERATIONS +{ + ADD_OBJECT_POLICY, + ADD_CURRENT_POLICY, + LAST_OPERATION +}; + +/// Using this to iterate over the OPERATIONS enum +OPERATIONS operator++(OPERATIONS& x) { return x = static_cast<OPERATIONS>(static_cast<uint16_t>(x) + 1); } +OPERATIONS operator*(OPERATIONS c) {return c;} +OPERATIONS begin(OPERATIONS ) {return OPERATIONS::ADD_OBJECT_POLICY;} +OPERATIONS end(OPERATIONS ) {return OPERATIONS::LAST_OPERATION;} + +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT("Compiler_Features_28_Test")); + + int16_t count = 0; + for (OPERATIONS op : OPERATIONS ()) + { + if (op == OPERATIONS::ADD_OBJECT_POLICY && count != 0) + ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); + if (op == OPERATIONS::ADD_CURRENT_POLICY && count != 1) + ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); + if (op == OPERATIONS::LAST_OPERATION && count != 2) + ACE_ERROR ((LM_ERROR, "Wrong order when using range based for loop\n")); + ++count; + } + + ACE_END_TEST; + + return 0; +} + +#else +int +run_main (int, ACE_TCHAR *[]) +{ + ACE_START_TEST (ACE_TEXT("Compiler_Features_28_Test")); + + ACE_DEBUG ((LM_INFO, + ACE_TEXT ("No C++11 support enabled\n"))); + + ACE_END_TEST; + return 0; +} + +#endif |