summaryrefslogtreecommitdiff
path: root/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2007-12-16 19:27:02 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2007-12-16 19:27:02 +0000
commitd3b686e017abf9ca943ab916ebe694feb7a24a75 (patch)
treeeea92f3d4a66acd410f624103ce590bd4681f983 /ACE/tests/Refcounted_Auto_Ptr_Test.cpp
parentd4689025d1992f41a6492b0f082d45c3e09126c9 (diff)
downloadATCD-d3b686e017abf9ca943ab916ebe694feb7a24a75.tar.gz
Sun Dec 16 19:26:12 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'ACE/tests/Refcounted_Auto_Ptr_Test.cpp')
-rw-r--r--ACE/tests/Refcounted_Auto_Ptr_Test.cpp64
1 files changed, 58 insertions, 6 deletions
diff --git a/ACE/tests/Refcounted_Auto_Ptr_Test.cpp b/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
index 8331908d150..f62a3b1cb24 100644
--- a/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
+++ b/ACE/tests/Refcounted_Auto_Ptr_Test.cpp
@@ -346,7 +346,7 @@ static int test_reset_release (void)
int errors = 0;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test copy constructor\n")));
- Printer_Ptr bar = new Printer ("1");
+ Printer_Ptr bar(new Printer ("1"));
Printer_Ptr fum = bar;
if (!expect (ACE_TEXT ("bar"), bar, false, 1, 1))
++errors;
@@ -361,7 +361,7 @@ static int test_reset_release (void)
++errors;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test release\n")));
- Printer_Ptr fie = new Printer ("3");
+ Printer_Ptr fie(new Printer ("3"));
Printer_Ptr foe = fie;
foe.release();
if (!expect (ACE_TEXT ("fie"), fie, false, 3, 0))
@@ -370,7 +370,7 @@ static int test_reset_release (void)
++errors;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test assignment to null\n")));
- Printer_Ptr fee = new Printer ("4");
+ Printer_Ptr fee(new Printer ("4"));
Printer_Ptr eraser;
fee = eraser;
if (!expect (ACE_TEXT ("fee"), fee, true, 0, 0))
@@ -379,8 +379,8 @@ static int test_reset_release (void)
++errors;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test assignment to value\n")));
- Printer_Ptr fix = new Printer ("5");
- Printer_Ptr fax = new Printer ("6");
+ Printer_Ptr fix(new Printer ("5"));
+ Printer_Ptr fax(new Printer ("6"));
fix = fax;
if (!expect (ACE_TEXT ("fix"), fix, false, 6, 1))
++errors;
@@ -388,7 +388,7 @@ static int test_reset_release (void)
++errors;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Test reset to null\n")));
- Printer_Ptr fey = new Printer ("7");
+ Printer_Ptr fey(new Printer ("7"));
Printer_Ptr flo = fey;
flo.reset ();
if (!expect (ACE_TEXT ("fey"), fey, false, 7, 0))
@@ -399,6 +399,55 @@ static int test_reset_release (void)
return errors;
}
+static int test_operator(void)
+{
+ int errors = 0;
+
+ // test null
+ Printer_Ptr printer_null;
+ if (!printer_null)
+ {
+ }
+ else
+ {
+ ++errors;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("!printer_null should be false\n")));
+ }
+ if (printer_null)
+ {
+ ++errors;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("printer_null should be false\n")));
+ }
+ else
+ {
+ }
+
+ // test not null
+ Printer_Ptr printer_not_null(new Printer("check not null"));
+ if (!printer_not_null)
+ {
+ ++errors;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("!printer_not_null should be false\n")));
+ }
+ else
+ {
+ }
+ if (printer_not_null)
+ {
+ }
+ else
+ {
+ ++errors;
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("printer_not_null should be false\n")));
+ }
+
+ return errors;
+}
+
int
run_main (int, ACE_TCHAR *[])
{
@@ -493,6 +542,9 @@ run_main (int, ACE_TCHAR *[])
}
#endif /* ACE_HAS_THREADS */
+
+ test_errors += test_operator();
+
ACE_END_TEST;
return test_errors;