diff options
Diffstat (limited to 'ACE/tests/RB_Tree_Test.cpp')
-rw-r--r-- | ACE/tests/RB_Tree_Test.cpp | 542 |
1 files changed, 167 insertions, 375 deletions
diff --git a/ACE/tests/RB_Tree_Test.cpp b/ACE/tests/RB_Tree_Test.cpp index 1b3658d72b1..c276a96cafd 100644 --- a/ACE/tests/RB_Tree_Test.cpp +++ b/ACE/tests/RB_Tree_Test.cpp @@ -97,413 +97,279 @@ run_main (int, ACE_TCHAR *[]) str_int_test.run_test (); str_str_test.run_test (); -// ======= Stress Test contributed by Klaus H. Wolf <hw@cyland.com> ========= +// ======= Stress Test contributed by Klaus H. Wolf <hw@cyland.com> ================== ACE_RB_Tree<ACE_CString, int, ACE_Less_Than<ACE_CString>, ACE_Null_Mutex> tree; tree.bind (ACE_CString ("51"), 1); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("13"), 2); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("36"), 3); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("15"), 4); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("22"), 5); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("25"), 6); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("42"), 7); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("48"), 8); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("03"), 9); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("56"), 10); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("28"), 11); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("55"), 12); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("21"), 13); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("62"), 14); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("18"), 15); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("20"), 16); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("26"), 17); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("29"), 18); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("50"), 19); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("05"), 20); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("59"), 21); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("65"), 22); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("66"), 23); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("45"), 24); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("34"), 25); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("27"), 26); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("40"), 27); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("30"), 28); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("64"), 29); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("11"), 30); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("16"), 31); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("47"), 32); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("10"), 33); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("37"), 34); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("09"), 35); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("54"), 36); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("23"), 37); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("44"), 38); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("19"), 39); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("00"), 40); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("04"), 41); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("63"), 42); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("08"), 43); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("39"), 44); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("31"), 45); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("02"), 46); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("33"), 47); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("60"), 48); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("61"), 49); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("57"), 50); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("43"), 51); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("46"), 52); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("38"), 53); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("01"), 54); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("12"), 55); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("24"), 56); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("52"), 57); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("07"), 58); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("14"), 59); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("06"), 60); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("58"), 61); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("49"), 62); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("17"), 63); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("53"), 64); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("32"), 65); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("35"), 66); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.bind (ACE_CString ("41"), 67); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("51")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("13")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("36")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("15")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("22")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("25")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("42")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("48")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("03")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("56")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("28")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("55")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("21")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("62")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("18")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("20")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("26")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("29")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("50")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("05")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("59")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("65")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("66")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("45")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("34")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("27")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("40")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("30")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("64")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("11")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("16")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("47")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("10")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("37")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("09")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("54")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("23")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("44")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("19")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("00")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("04")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("63")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("08")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("39")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("31")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("02")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("33")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("60")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("61")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("57")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("43")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("46")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("38")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("01")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("12")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("24")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("52")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("07")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("14")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("06")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("58")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("49")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("17")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("53")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("32")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("35")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); tree.unbind (ACE_CString ("41")); - if (0 != tree.test_invariant ()) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Invariant failure at line %l\n"))); + ACE_ASSERT (tree.test_invariant () == 0); // ======== End Stress Test =================== @@ -566,32 +432,20 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_tree_insertion (v { INT_ID item; int k = order_index_ [i]; - if (!(k >= 0 && k < entry_count_)) - ACE_ERROR ((LM_ERROR, ACE_TEXT ("Assert failure at line %l\n"))); + ACE_ASSERT (k >= 0 && k < entry_count_); // Test the new stable ACE_Hash_Map_Manager_Ex compliant interface. - if (0 != stable_tree_.bind (key_array_ [k], item_array_ [k])) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable bind %p\n"), - ACE_TEXT ("failure"))); - - if (0 != stable_tree_.find (key_array_ [k], item) || - item != item_array_ [k]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable find %p\n"), - ACE_TEXT ("failure"))); + ACE_ASSERT (stable_tree_.bind (key_array_ [k], + item_array_ [k]) == 0); + ACE_ASSERT (stable_tree_.find (key_array_ [k], item) == 0 + && item == item_array_ [k]); // Test the deprecated interface. - if (0 == deprecated_tree_.insert (key_array_ [k], item_array_ [k])) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated insert %p\n"), - ACE_TEXT ("failure"))); - - if (0 == deprecated_tree_.find (key_array_ [k]) || - *deprecated_tree_.find (key_array_ [k]) != item_array_ [k]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated find %p\n"), - ACE_TEXT ("failure"))); + ACE_ASSERT (deprecated_tree_.insert (key_array_ [k], + item_array_ [k]) != 0); + ACE_ASSERT (deprecated_tree_.find (key_array_ [k]) != 0 + && *deprecated_tree_.find (key_array_ [k]) == + item_array_ [k]); } } @@ -615,32 +469,16 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_post_insertion_it INT_ID item; item = (*stable_fwd_iter_).item (); - if (item != item_array_ [i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [i]); item = (*stable_rev_iter_).item (); - if (item != item_array_ [entry_count_ - i - 1]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable rev iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [entry_count_ - i - 1]); item = (*deprecated_fwd_iter_).item (); - if (item != item_array_ [i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated fwd iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [i]); item = (*deprecated_rev_iter_).item (); - if (item != item_array_ [entry_count_ - i - 1]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated rev iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [entry_count_ - i - 1]); // Advance each iterator. ++stable_fwd_iter_; @@ -657,18 +495,11 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_post_insertion_it // Make sure each item in each tree has been visited - if (stable_fwd_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter not done but should be\n"))); - if (stable_rev_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter not done but should be\n"))); - if (deprecated_fwd_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter not done but should be\n"))); - if (deprecated_rev_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter not done but should be\n"))); + ACE_ASSERT (stable_fwd_iter_.done () == 1); + ACE_ASSERT (stable_rev_iter_.done () == 1); + ACE_ASSERT (deprecated_fwd_iter_.done () == 1); + ACE_ASSERT (deprecated_rev_iter_.done () == 1); + } template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> void @@ -683,11 +514,7 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_partial_iteration INT_ID item; item = (*part_rev_iter_).item (); - if (item != item_array_ [i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Partial rev iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [i]); part_rev_iter_++; } @@ -697,11 +524,7 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_partial_iteration INT_ID item; item = (*part_fwd_iter_).item (); - if (item != item_array_ [k]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Partial fwd iter, pass %d %p\n"), - k, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [k]); part_fwd_iter_++; } } @@ -717,18 +540,10 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_tree_deletion (vo { // Test the new stable ACE_Hash_Map_Manager_Ex compliant // interface. - if (stable_tree_.unbind (key_array_ [i]) != 0) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable tree, failure pass %d %p\n"), - i, - ACE_TEXT ("unbind"))); + ACE_ASSERT (stable_tree_.unbind (key_array_ [i]) == 0); // Test the deprecated interface. - if (deprecated_tree_.remove (key_array_ [i]) != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated tree, failure pass %d %p\n"), - i, - ACE_TEXT ("remove"))); + ACE_ASSERT (deprecated_tree_.remove (key_array_ [i]) == 1); } } @@ -753,32 +568,17 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_post_deletion_ite INT_ID item; item = (*stable_fwd_iter_).item (); - if (item != item_array_ [i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [i]); + item = (*stable_rev_iter_).item (); - if (item != item_array_ [entry_count_ - i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable rev iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [entry_count_ - i]); item = (*deprecated_fwd_iter_).item (); - if (item != item_array_ [i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated fwd iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [i]); item = (*deprecated_rev_iter_).item (); - if (item != item_array_ [entry_count_ - i]) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated rev iter, pass %d %p\n"), - i, - ACE_TEXT ("failure"))); + ACE_ASSERT (item == item_array_ [entry_count_ - i]); // Advance each iterator via postfix increment. stable_fwd_iter_++; @@ -788,18 +588,10 @@ ACE_RB_Tree_Test<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::test_post_deletion_ite } // Make sure each item in each tree has been visited a second time. - if (stable_fwd_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable fwd iter not done but should be\n"))); - if (stable_rev_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Stable rev iter not done but should be\n"))); - if (deprecated_fwd_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated fwd iter not done but should be\n"))); - if (deprecated_rev_iter_.done () != 1) - ACE_ERROR ((LM_ERROR, - ACE_TEXT ("Deprecated rev iter not done but should be\n"))); + ACE_ASSERT (stable_fwd_iter_.done () == 1); + ACE_ASSERT (stable_rev_iter_.done () == 1); + ACE_ASSERT (deprecated_fwd_iter_.done () == 1); + ACE_ASSERT (deprecated_rev_iter_.done () == 1); } |