summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 11:43:47 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 11:43:47 +0000
commit391431c8260d8525af265fc39291508ca8840208 (patch)
treee6f1cf10a12705e6e2430956ae3be8bb3fb4b5cc
parent4ae3513ca392d3dfefb9343f559f3c4a42fb1e85 (diff)
downloadATCD-391431c8260d8525af265fc39291508ca8840208.tar.gz
Thu Jul 2 11:38:15 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* tests/Compiler_Features_04_Test.cpp: Test for std::set<> * tests/Compiler_Features_05_Test.cpp: Test for std::queue<>, this is a different sort of test because std::queue<> is an adaptor, not a collection. The default collection is a std::deque<>, so we are testing default template parameters at the same time. * tests/Compiler_Features_06_Test.cpp: Test for std::set<> with a different order function. * tests/run_test.lst: * tests/Makefile.am: * tests/tests.mpc: Add the compilation / run parafernalia.
-rw-r--r--ACE/ChangeLog19
-rw-r--r--ACE/tests/Compiler_Features_04_Test.cpp83
-rw-r--r--ACE/tests/Compiler_Features_05_Test.cpp68
-rw-r--r--ACE/tests/Compiler_Features_06_Test.cpp91
-rw-r--r--ACE/tests/Makefile.am60
-rw-r--r--ACE/tests/run_test.lst3
-rw-r--r--ACE/tests/tests.mpc21
7 files changed, 345 insertions, 0 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index f8b82cb2d65..d554e62c106 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,22 @@
+Thu Jul 2 11:38:15 UTC 2009 Carlos O'Ryan <coryan@glamdring>
+
+ * tests/Compiler_Features_04_Test.cpp:
+ Test for std::set<>
+
+ * tests/Compiler_Features_05_Test.cpp:
+ Test for std::queue<>, this is a different sort of test because
+ std::queue<> is an adaptor, not a collection. The default
+ collection is a std::deque<>, so we are testing default template
+ parameters at the same time.
+
+ * tests/Compiler_Features_06_Test.cpp:
+ Test for std::set<> with a different order function.
+
+ * tests/run_test.lst:
+ * tests/Makefile.am:
+ * tests/tests.mpc:
+ Add the compilation / run parafernalia.
+
Thu Jul 2 03:13:27 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* tests/Makefile.am:
diff --git a/ACE/tests/Compiler_Features_04_Test.cpp b/ACE/tests/Compiler_Features_04_Test.cpp
new file mode 100644
index 00000000000..c500f50f24c
--- /dev/null
+++ b/ACE/tests/Compiler_Features_04_Test.cpp
@@ -0,0 +1,83 @@
+// $Id$
+
+/**
+ * @file
+ *
+ * This program checks if the compiler / platform supports the
+ * std::set 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 <set>
+
+ACE_RCSID(tests, Compiler_Features_04_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_04_Test"));
+
+ // As usual, the exit status from the test is 0 on success, 1 on
+ // failure
+ int status = 0;
+
+ // Create a simple list ...
+ typedef std::set<int> collection;
+ collection c;
+
+ // ... insert some elements ...
+ c.insert(5);
+ c.insert(4);
+ c.insert(3);
+ c.insert(2);
+ c.insert(1);
+
+ // ... inserting twice returns a pair ...
+ std::pair<collection::iterator,bool> r =
+ c.insert(collection::value_type(5));
+
+ // ... the iterator points to the element ...
+ if (*r.first != 5)
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected to find 5 already in set")));
+ }
+
+ // ... and the booleans says that it is already in the set ...
+ if (r.second == true)
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected duplicate insert to fail")));
+ }
+
+ // ... add all the numbers to validate that they are there ...
+ int sum = 0;
+ for(collection::iterator i = c.begin(), end = c.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/Compiler_Features_05_Test.cpp b/ACE/tests/Compiler_Features_05_Test.cpp
new file mode 100644
index 00000000000..386d9a4a4d6
--- /dev/null
+++ b/ACE/tests/Compiler_Features_05_Test.cpp
@@ -0,0 +1,68 @@
+// $Id$
+
+/**
+ * @file
+ *
+ * This program checks if the compiler / platform supports the
+ * std::queue container. The motivation for this test was a discussion
+ * on the development mailing queue, 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 <queue>
+
+ACE_RCSID(tests, Compiler_Features_05_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_05_Test"));
+
+ // As usual, the exit status from the test is 0 on success, 1 on
+ // failure
+ int status = 0;
+
+ // Create a simple queue ...
+ typedef std::queue<int> collection;
+ // ... if the previous line compiles, the default template
+ // parameters work. The declaration of queue<> is something like:
+ // template<typename T, typename Sequence = deque<T> >
+ // notice that this is not a template template parameter...
+ collection c;
+
+ // ... insert some elements ...
+ c.push(5);
+ c.push(4);
+ c.push(3);
+ c.push(2);
+ c.push(1);
+
+ // ... add all the numbers to validate that they are there ...
+ int sum = 0;
+ while (! c.empty())
+ {
+ sum += c.front();
+ c.pop();
+ }
+
+ // ... 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/Compiler_Features_06_Test.cpp b/ACE/tests/Compiler_Features_06_Test.cpp
new file mode 100644
index 00000000000..c5991bc54cb
--- /dev/null
+++ b/ACE/tests/Compiler_Features_06_Test.cpp
@@ -0,0 +1,91 @@
+// $Id$
+
+/**
+ * @file
+ *
+ * This program checks if the compiler / platform supports alternative
+ * sorting functions in the std::set 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 <set>
+
+ACE_RCSID(tests, Compiler_Features_04_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_04_Test"));
+
+ // As usual, the exit status from the test is 0 on success, 1 on
+ // failure
+ int status = 0;
+
+ // Create a simple list ...
+ typedef std::set<int,std::greater<int> > collection;
+ collection c;
+
+ // ... insert some elements ...
+ c.insert(5);
+ c.insert(4);
+ c.insert(3);
+ c.insert(2);
+ c.insert(1);
+
+ // ... inserting twice returns a pair ...
+ std::pair<collection::iterator,bool> r =
+ c.insert(collection::value_type(5));
+
+ // ... the iterator points to the element ...
+ if (*r.first != 5)
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected to find 5 already in set")));
+ }
+
+ // ... and the booleans says that it is already in the set ...
+ if (r.second == true)
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected duplicate insert to fail")));
+ }
+
+ // ... make sure the first element is the biggest one ...
+ if (5 != *c.begin())
+ {
+ status = 1;
+ ACE_ERROR ((LM_ERROR, ACE_TEXT("Expected largest element (5) at the front")));
+ }
+
+ // ... add all the numbers to validate that they are there ...
+ int sum = 0;
+ for(collection::iterator i = c.begin(), end = c.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 232fd72b34b..7ed03c3cf57 100644
--- a/ACE/tests/Makefile.am
+++ b/ACE/tests/Makefile.am
@@ -703,6 +703,66 @@ Compiler_Features_03_Test_LDADD = \
endif !BUILD_ACE_FOR_TAO
+## Makefile.Compiler_Features_04_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_04_Test
+
+Compiler_Features_04_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_04_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_04_Test.cpp \
+
+Compiler_Features_04_Test_LDADD = \
+ libTest_Output.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Compiler_Features_05_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_05_Test
+
+Compiler_Features_05_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_05_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_05_Test.cpp \
+
+Compiler_Features_05_Test_LDADD = \
+ libTest_Output.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Compiler_Features_06_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_06_Test
+
+Compiler_Features_06_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_06_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_06_Test.cpp \
+
+Compiler_Features_06_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/run_test.lst b/ACE/tests/run_test.lst
index 2b07363760f..ba0dae58d8b 100644
--- a/ACE/tests/run_test.lst
+++ b/ACE/tests/run_test.lst
@@ -64,6 +64,9 @@ Collection_Test
Compiler_Features_01_Test
Compiler_Features_02_Test
Compiler_Features_03_Test
+Compiler_Features_04_Test
+Compiler_Features_05_Test
+Compiler_Features_06_Test
Config_Test: !LynxOS !VxWorks !ACE_FOR_TAO
Conn_Test: !ACE_FOR_TAO
DLL_Test: !Unicos !STATIC !KCC_Linux
diff --git a/ACE/tests/tests.mpc b/ACE/tests/tests.mpc
index 37d49f6ce1a..be047f32b96 100644
--- a/ACE/tests/tests.mpc
+++ b/ACE/tests/tests.mpc
@@ -457,6 +457,27 @@ project(Compiler_Features_03_Test) : acetest {
}
}
+project(Compiler_Features_04_Test) : acetest {
+ exename = Compiler_Features_04_Test
+ Source_Files {
+ Compiler_Features_04_Test.cpp
+ }
+}
+
+project(Compiler_Features_05_Test) : acetest {
+ exename = Compiler_Features_05_Test
+ Source_Files {
+ Compiler_Features_05_Test.cpp
+ }
+}
+
+project(Compiler_Features_06_Test) : acetest {
+ exename = Compiler_Features_06_Test
+ Source_Files {
+ Compiler_Features_06_Test.cpp
+ }
+}
+
project(Config Test) : acetest {
avoids += ace_for_tao
exename = Config_Test