summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 02:47:22 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 02:47:22 +0000
commitd8385b718abe72af689603fa3105a961255ee82f (patch)
tree39ee6a18127a9a9365d0dcb36d455f5a42c5182a
parentd67f48e4900c32166d4fa792fe3ffb0df5aa57fb (diff)
downloadATCD-d8385b718abe72af689603fa3105a961255ee82f.tar.gz
Thu Jul 2 02:45:13 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* tests/tests.mpc: * tests/Makefile.am: * tests/Compiler_Features_01_Test.cpp: Add first test for "modern" C++ compiler features. In this case, I test if the std::list<> class works.
-rw-r--r--ACE/ChangeLog8
-rw-r--r--ACE/tests/Compiler_Features_01_Test.cpp64
-rw-r--r--ACE/tests/Makefile.am20
-rw-r--r--ACE/tests/tests.mpc7
4 files changed, 99 insertions, 0 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index 96a318cfed3..4f87b9503c3 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,11 @@
+Thu Jul 2 02:45:13 UTC 2009 Carlos O'Ryan <coryan@glamdring>
+
+ * tests/tests.mpc:
+ * tests/Makefile.am:
+ * tests/Compiler_Features_01_Test.cpp:
+ Add first test for "modern" C++ compiler features. In this
+ case, I test if the std::list<> class works.
+
Wed Jul 1 13:09:34 UTC 2009 Olli Savia <ops@iki.fi>
* ace/config-openbsd.h:
diff --git a/ACE/tests/Compiler_Features_01_Test.cpp b/ACE/tests/Compiler_Features_01_Test.cpp
new file mode 100644
index 00000000000..9571c0e096d
--- /dev/null
+++ b/ACE/tests/Compiler_Features_01_Test.cpp
@@ -0,0 +1,64 @@
+// $Id$
+
+/**
+ * @file
+ *
+ * This program checks if the compiler / platform supports the
+ * std::list container. The motivation for this test was a discussion
+ * on the development mailing list, and the documentation was captured
+ * in:
+ *
+ * http://bugzilla.dre.vanderbilt.edu/show_bug.cgi?id=3715
+ *
+ */
+
+#include "test_config.h"
+
+// The first part of the test is to compile this line. If the program
+// does not compile the platform is just too broken.
+#include <list>
+
+ACE_RCSID(tests, Compiler_Features_01_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_01_Test"));
+
+ // As usual, the exit status from the test is 0 on success, 1 on
+ // failure
+ int status = 0;
+
+ // Create a simple list ...
+ std::list<int> the_list;
+
+ // ... insert some elements ...
+ the_list.push_back(5);
+ the_list.push_back(4);
+ the_list.push_back(3);
+ the_list.push_back(2);
+ the_list.push_back(1);
+
+ // ... add all the numbers to validate that they are there ...
+ int sum = 0;
+ for(std::list<int>::iterator i = the_list.begin(), end = the_list.end();
+ i != end;
+ ++i)
+ {
+ sum += *i;
+ }
+
+ // ... remember Euler ...
+ int const expected = 5*(5+1)/2;
+ if (sum != expected)
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected %d got %d\n"),
+ expected, sum));
+ }
+
+ ACE_END_TEST;
+ return status;
+}
+
+
diff --git a/ACE/tests/Makefile.am b/ACE/tests/Makefile.am
index 737f93582d7..af1eca6d359 100644
--- a/ACE/tests/Makefile.am
+++ b/ACE/tests/Makefile.am
@@ -643,6 +643,26 @@ Collection_Test_LDADD = \
libTest_Output.la \
$(ACE_BUILDDIR)/ace/libACE.la
+## Makefile.Compiler_Features_01_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_01_Test
+
+Compiler_Features_01_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_01_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_01_Test.cpp \
+
+Compiler_Features_01_Test_LDADD = \
+ libTest_Output.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
## Makefile.Config_Test.am
if !BUILD_ACE_FOR_TAO
diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc
index 8ee5cef9ce8..84fcb8933c0 100644
--- a/ACE/tests/tests.mpc
+++ b/ACE/tests/tests.mpc
@@ -436,6 +436,13 @@ project(Collection Test) : acetest {
}
}
+project(Compiler_Features_01_Test) : acetest {
+ exename = Compiler_Features_01_Test
+ Source_Files {
+ Compiler_Features_01_Test.cpp
+ }
+}
+
project(Config Test) : acetest {
avoids += ace_for_tao
exename = Config_Test