summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 12:11:48 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2009-07-02 12:11:48 +0000
commitd13b27359e58220368c9a8b9f5dc1306ce3bdd4c (patch)
treed04fa5d231d0daabbe4412177f4105c999c555c8
parent391431c8260d8525af265fc39291508ca8840208 (diff)
downloadATCD-d13b27359e58220368c9a8b9f5dc1306ce3bdd4c.tar.gz
Thu Jul 2 12:05:03 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* tests/Compiler_Features_07_Test.cpp: Test for std::string * tests/Compiler_Features_08_Test.cpp: Test for std::wstring * tests/Compiler_Features_09_Test.cpp: Test for std::auto_ptr<> * tests/Compiler_Features_06_Test.cpp: Fixed typo in test name. * 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_06_Test.cpp4
-rw-r--r--ACE/tests/Compiler_Features_07_Test.cpp83
-rw-r--r--ACE/tests/Compiler_Features_08_Test.cpp83
-rw-r--r--ACE/tests/Compiler_Features_09_Test.cpp108
-rw-r--r--ACE/tests/Makefile.am60
-rw-r--r--ACE/tests/run_test.lst3
-rw-r--r--ACE/tests/tests.mpc21
8 files changed, 379 insertions, 2 deletions
diff --git a/ACE/ChangeLog b/ACE/ChangeLog
index d554e62c106..a739ff79d31 100644
--- a/ACE/ChangeLog
+++ b/ACE/ChangeLog
@@ -1,3 +1,22 @@
+Thu Jul 2 12:05:03 UTC 2009 Carlos O'Ryan <coryan@glamdring>
+
+ * tests/Compiler_Features_07_Test.cpp:
+ Test for std::string
+
+ * tests/Compiler_Features_08_Test.cpp:
+ Test for std::wstring
+
+ * tests/Compiler_Features_09_Test.cpp:
+ Test for std::auto_ptr<>
+
+ * tests/Compiler_Features_06_Test.cpp:
+ Fixed typo in test name.
+
+ * tests/run_test.lst:
+ * tests/Makefile.am:
+ * tests/tests.mpc:
+ Add the compilation / run parafernalia.
+
Thu Jul 2 11:38:15 UTC 2009 Carlos O'Ryan <coryan@glamdring>
* tests/Compiler_Features_04_Test.cpp:
diff --git a/ACE/tests/Compiler_Features_06_Test.cpp b/ACE/tests/Compiler_Features_06_Test.cpp
index c5991bc54cb..7a4c6baf60b 100644
--- a/ACE/tests/Compiler_Features_06_Test.cpp
+++ b/ACE/tests/Compiler_Features_06_Test.cpp
@@ -19,12 +19,12 @@
// does not compile the platform is just too broken.
#include <set>
-ACE_RCSID(tests, Compiler_Features_04_Test, "$Id$")
+ACE_RCSID(tests, Compiler_Features_06_Test, "$Id$")
int
run_main (int, ACE_TCHAR *[])
{
- ACE_START_TEST (ACE_TEXT("Compiler_Features_04_Test"));
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_06_Test"));
// As usual, the exit status from the test is 0 on success, 1 on
// failure
diff --git a/ACE/tests/Compiler_Features_07_Test.cpp b/ACE/tests/Compiler_Features_07_Test.cpp
new file mode 100644
index 00000000000..332f1e0894f
--- /dev/null
+++ b/ACE/tests/Compiler_Features_07_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>
+#include <string>
+
+ACE_RCSID(tests, Compiler_Features_07_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_07_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<std::string> collection;
+ collection c;
+
+ // ... insert some elements ...
+ c.insert("5");
+ c.insert("4");
+ c.insert("3");
+ c.insert("2");
+ c.insert(std::string("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 != std::string("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")));
+ }
+
+ // ... find an element and erase it ...
+ collection::iterator i;
+
+ i = c.find(std::string("4"));
+ if (i == c.end())
+ {
+ status = 1;
+ ACE_ERROR((LM_ERROR, ACE_TEXT("Element not found")));
+ }
+ else
+ {
+ // ... this demonstrates a standard STL technique, you can
+ // optimize lookups by using the iterators returned in search
+ // functions ...
+ c.erase(i);
+ }
+
+ ACE_END_TEST;
+ return status;
+}
+
+
diff --git a/ACE/tests/Compiler_Features_08_Test.cpp b/ACE/tests/Compiler_Features_08_Test.cpp
new file mode 100644
index 00000000000..1842111d66f
--- /dev/null
+++ b/ACE/tests/Compiler_Features_08_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>
+#include <string>
+
+ACE_RCSID(tests, Compiler_Features_08_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_08_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<std::wstring> collection;
+ collection c;
+
+ // ... insert some elements ...
+ c.insert(L"5");
+ c.insert(L"4");
+ c.insert(L"3");
+ c.insert(L"2");
+ c.insert(std::wstring(L"1"));
+
+ // ... inserting twice returns a pair ...
+ std::pair<collection::iterator,bool> r =
+ c.insert(collection::value_type(L"5"));
+
+ // ... the iterator points to the element ...
+ if (*r.first != std::wstring(L"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")));
+ }
+
+ // ... find an element and erase it ...
+ collection::iterator i;
+
+ i = c.find(std::wstring(L"4"));
+ if (i == c.end())
+ {
+ status = 1;
+ ACE_ERROR((LM_ERROR, ACE_TEXT("Element not found")));
+ }
+ else
+ {
+ // ... this demonstrates a standard STL technique, you can
+ // optimize lookups by using the iterators returned in search
+ // functions ...
+ c.erase(i);
+ }
+
+ ACE_END_TEST;
+ return status;
+}
+
+
diff --git a/ACE/tests/Compiler_Features_09_Test.cpp b/ACE/tests/Compiler_Features_09_Test.cpp
new file mode 100644
index 00000000000..ce32feb36fc
--- /dev/null
+++ b/ACE/tests/Compiler_Features_09_Test.cpp
@@ -0,0 +1,108 @@
+// $Id$
+
+/**
+ * @file
+ *
+ * This program checks if the compiler / platform supports the
+ * std::auto_ptr<> correctly. 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 <memory>
+
+// For extra challenge, we use the anonymous namespace
+namespace
+{
+/**
+ * @class Base
+ */
+class Base
+{
+public:
+ Base()
+ {
+ constructors++;
+ }
+ Base(Base const & )
+ {
+ constructors++;
+ }
+ ~Base()
+ {
+ destructors++;
+ }
+
+ static int constructors;
+ static int destructors;
+};
+
+int Base::constructors = 0;
+int Base::destructors = 0;
+
+class Derived : public Base
+{
+public:
+ Derived()
+ : Base()
+ {}
+};
+}
+
+ACE_RCSID(tests, Compiler_Features_09_Test, "$Id$")
+
+int
+run_main (int, ACE_TCHAR *[])
+{
+ ACE_START_TEST (ACE_TEXT("Compiler_Features_09_Test"));
+
+ // As usual, the exit status from the test is 0 on success, 1 on
+ // failure
+ int status = 0;
+
+ // ... this works with the ACE version of auto_ptr (well, the
+ // namespace is broken, but you get the idea) ...
+ std::auto_ptr<Base> x(new Base);
+ std::auto_ptr<Derived> y(new Derived);
+
+ // ... this does *not* work ...
+ x = y;
+
+ // ... there should be just one destruction so far ...
+ if (Base::destructors != 1)
+ {
+ status = 1;
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("Destructor count off, expected 1, found %d\n"),
+ Base::destructors));
+ }
+
+ std::auto_ptr<Base> z;
+ z = x;
+ if (Base::destructors != 1)
+ {
+ status = 1;
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("Destructor count off, expected 1, found %d\n"),
+ Base::destructors));
+ }
+ if (x.get())
+ {
+ status = 1;
+ ACE_ERROR((LM_ERROR,
+ ACE_TEXT("x contents should have been transferred\n")
+ ));
+ }
+
+ ACE_END_TEST;
+ return status;
+}
+
+
diff --git a/ACE/tests/Makefile.am b/ACE/tests/Makefile.am
index 7ed03c3cf57..a287ac14afb 100644
--- a/ACE/tests/Makefile.am
+++ b/ACE/tests/Makefile.am
@@ -763,6 +763,66 @@ Compiler_Features_06_Test_LDADD = \
endif !BUILD_ACE_FOR_TAO
+## Makefile.Compiler_Features_07_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_07_Test
+
+Compiler_Features_07_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_07_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_07_Test.cpp \
+
+Compiler_Features_07_Test_LDADD = \
+ libTest_Output.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Compiler_Features_08_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_08_Test
+
+Compiler_Features_08_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_08_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_08_Test.cpp \
+
+Compiler_Features_08_Test_LDADD = \
+ libTest_Output.la \
+ $(ACE_BUILDDIR)/ace/libACE.la
+
+endif !BUILD_ACE_FOR_TAO
+
+## Makefile.Compiler_Features_09_Test.am
+
+if !BUILD_ACE_FOR_TAO
+
+noinst_PROGRAMS += Compiler_Features_09_Test
+
+Compiler_Features_09_Test_CPPFLAGS = \
+ -I$(ACE_ROOT) \
+ -I$(ACE_BUILDDIR)
+
+Compiler_Features_09_Test_SOURCES = \
+ $(ACE_ROOT)/tests/Main.cpp \
+ Compiler_Features_09_Test.cpp \
+
+Compiler_Features_09_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 ba0dae58d8b..888f36629d8 100644
--- a/ACE/tests/run_test.lst
+++ b/ACE/tests/run_test.lst
@@ -67,6 +67,9 @@ Compiler_Features_03_Test
Compiler_Features_04_Test
Compiler_Features_05_Test
Compiler_Features_06_Test
+Compiler_Features_07_Test
+Compiler_Features_08_Test
+Compiler_Features_09_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 be047f32b96..eb6223505aa 100644
--- a/ACE/tests/tests.mpc
+++ b/ACE/tests/tests.mpc
@@ -478,6 +478,27 @@ project(Compiler_Features_06_Test) : acetest {
}
}
+project(Compiler_Features_07_Test) : acetest {
+ exename = Compiler_Features_07_Test
+ Source_Files {
+ Compiler_Features_07_Test.cpp
+ }
+}
+
+project(Compiler_Features_08_Test) : acetest {
+ exename = Compiler_Features_08_Test
+ Source_Files {
+ Compiler_Features_08_Test.cpp
+ }
+}
+
+project(Compiler_Features_09_Test) : acetest {
+ exename = Compiler_Features_09_Test
+ Source_Files {
+ Compiler_Features_09_Test.cpp
+ }
+}
+
project(Config Test) : acetest {
avoids += ace_for_tao
exename = Config_Test