summaryrefslogtreecommitdiff
path: root/ACE/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/tests')
-rw-r--r--ACE/tests/Compiler_Features_40_Test.cpp120
1 files changed, 59 insertions, 61 deletions
diff --git a/ACE/tests/Compiler_Features_40_Test.cpp b/ACE/tests/Compiler_Features_40_Test.cpp
index 5dc312ca8fe..b4a18d832af 100644
--- a/ACE/tests/Compiler_Features_40_Test.cpp
+++ b/ACE/tests/Compiler_Features_40_Test.cpp
@@ -1,13 +1,11 @@
/**
* This program checks if the compiler/RTL does have correct support
- * for stack unwinding
+ * for stack unwinding
*/
#include "test_config.h"
#include <vector>
#include <string>
-//#include <vcl.h>
-#include "ace/SString.h"
class TTestClass;
@@ -16,50 +14,40 @@ static bool isDataCorrupt = false;
class TTestClass
{
- unsigned char data[256];
-
- public:
-
- TTestClass()
- {
- this_pointer = this;
- //Generate a sequence of numbers (0 - 255)
- for (int i = 0; i < 256; i++)
- {
- data[i] = i;
- }
-SomeData.push_back ("Foo");
- // ACE_DEBUG((LM_DEBUG, "Constructor called with %@\n", this));
- }
-
- ~TTestClass()
- {
-// ACE_DEBUG((LM_DEBUG, "Destructor called with %@\n", this));
-
-//if (this != this_pointer)
-//ACE_ERROR ((LM_ERROR, "ERROR: Invalid this\n"));
- //Check if number sequence is still the same
-
- for (int i = 0; i < 256; i++)
- {
- if (data[i] != i)
- {
- isDataCorrupt = true;
- break;
- }
- }
-
- if (isDataCorrupt)
- {
-MessageBoxW(0, L"Object data is corrupt!", L"Fatal error", 0x30);
- ACE_ERROR((LM_ERROR, "ERROR: Invalid data\n"));
- }
-else
-ACE_DEBUG ((LM_DEBUG, "Correct data\n"));
- }
-
- private:
- std::vector<std::string> SomeData;
+ unsigned char data[256];
+
+public:
+ TTestClass()
+ {
+ this_pointer = this;
+
+ // Generate a sequence of numbers (0 - 255)
+ for (int i = 0; i < 256; i++)
+ {
+ data[i] = i;
+ }
+ }
+
+ ~TTestClass()
+ {
+ if (this != this_pointer)
+ {
+ ACE_ERROR ((LM_ERROR, "ERROR: Invalid this %@ != %@\n", this, this_pointer));
+ }
+
+ // Check if number sequence is still the same
+ for (int i = 0; i < 256; i++)
+ {
+ if (data[i] != i)
+ {
+ isDataCorrupt = true;
+ break;
+ }
+ }
+ }
+
+private:
+ std::vector<std::string> SomeData;
};
void SomeFunction(std::string)
@@ -69,18 +57,17 @@ void SomeFunction(std::string)
void Test()
{
- std::string str = "branch_b";
-
- if (std::strcmp(str.c_str(), "branch_a") == 0)
- {
- SomeFunction("");
- }
- else if (str == "branch_b")
- {
- TTestClass test;
- throw std::exception("Some exception");
- }
+ std::string str = "branch_b";
+ if (str == "branch_a")
+ {
+ SomeFunction("");
+ }
+ else if (str == "branch_b")
+ {
+ TTestClass test;
+ throw std::runtime_error("Some exception");
+ }
}
int
@@ -88,16 +75,27 @@ run_main (int, ACE_TCHAR *[])
{
ACE_START_TEST (ACE_TEXT("Compiler_Features_40_Test"));
- try
+ int retval = 0;
+ try
{
Test();
}
catch (...)
{
- }
+ }
+
+ if (isDataCorrupt)
+ {
+ ACE_ERROR((LM_ERROR, "ERROR: Invalid data\n"));
+ ++retval;
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG, "Correct data\n"));
+ }
ACE_END_TEST;
- return 0;
+ return retval;
}