Bug 489728. (Bv6a) Use passed() in TestTXMgr.cpp, Make passed() accept a va_list in TestHarness.h. f=sgautherie r=ehsan.

This commit is contained in:
Mark Capella 2012-02-28 10:17:15 +01:00
Родитель a372670d96
Коммит 7e95a30b4c
2 изменённых файлов: 68 добавлений и 157 удалений

Просмотреть файл

@ -792,8 +792,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Create transaction manager instance ... ");
nsCOMPtr<nsITransactionManager> mgr =
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
if (NS_FAILED(result) || !mgr) {
@ -801,7 +799,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_OUT_OF_MEMORY;
}
printf("passed\n");
passed("Create transaction manager instance");
/*******************************************************************
*
@ -809,7 +807,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call DoTransaction() with null transaction ... ");
result = mgr->DoTransaction(0);
if (result != NS_ERROR_NULL_POINTER) {
@ -817,7 +814,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call DoTransaction() with null transaction");
/*******************************************************************
*
@ -825,7 +822,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call UndoTransaction() with empty undo stack ... ");
result = mgr->UndoTransaction();
if (NS_FAILED(result)) {
@ -833,7 +829,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call UndoTransaction() with empty undo stack");
/*******************************************************************
*
@ -841,7 +837,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call RedoTransaction() with empty redo stack ... ");
result = mgr->RedoTransaction();
if (NS_FAILED(result)) {
@ -849,7 +844,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call RedoTransaction() with empty redo stack");
/*******************************************************************
*
@ -857,7 +852,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call SetMaxTransactionCount(-1) with empty undo and redo stacks ... ");
result = mgr->SetMaxTransactionCount(-1);
if (NS_FAILED(result)) {
@ -865,7 +859,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call SetMaxTransactionCount(-1) with empty undo and redo stacks");
/*******************************************************************
*
@ -873,7 +867,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call SetMaxTransactionCount(0) with empty undo and redo stacks ... ");
result = mgr->SetMaxTransactionCount(0);
if (NS_FAILED(result)) {
@ -881,7 +874,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call SetMaxTransactionCount(0) with empty undo and redo stacks");
/*******************************************************************
*
@ -889,7 +882,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call SetMaxTransactionCount(10) with empty undo and redo stacks ... ");
result = mgr->SetMaxTransactionCount(10);
if (NS_FAILED(result)) {
@ -897,7 +889,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call SetMaxTransactionCount(10) with empty undo and redo stacks");
/*******************************************************************
*
@ -905,15 +897,13 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call Clear() with empty undo and redo stack ... ");
result = mgr->Clear();
if (NS_FAILED(result)) {
printf("ERROR: Clear on empty undo and redo stack failed. (%d)\n", result);
return result;
}
printf("passed\n");
passed("Call Clear() with empty undo and redo stack");
PRInt32 numitems;
@ -923,7 +913,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call GetNumberOfUndoItems() with empty undo stack ... ");
result = mgr->GetNumberOfUndoItems(&numitems);
if (NS_FAILED(result)) {
@ -938,7 +927,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Call GetNumberOfUndoItems() with empty undo stack");
/*******************************************************************
*
@ -946,7 +935,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call GetNumberOfRedoItems() with empty redo stack ... ");
result = mgr->GetNumberOfRedoItems(&numitems);
if (NS_FAILED(result)) {
@ -961,7 +949,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Call GetNumberOfRedoItems() with empty redo stack");
nsITransaction *tx;
@ -971,8 +959,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call PeekUndoStack() with empty undo stack ... ");
tx = 0;
result = mgr->PeekUndoStack(&tx);
@ -988,7 +974,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Call PeekUndoStack() with empty undo stack");
/*******************************************************************
*
@ -996,8 +982,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call PeekRedoStack() with empty undo stack ... ");
tx = 0;
result = mgr->PeekRedoStack(&tx);
@ -1013,7 +997,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Call PeekRedoStack() with empty undo stack");
/*******************************************************************
*
@ -1021,8 +1005,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call AddListener() with null listener ... ");
result = mgr->AddListener(0);
if (result != NS_ERROR_NULL_POINTER) {
@ -1030,7 +1012,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call AddListener() with null listener");
/*******************************************************************
*
@ -1038,8 +1020,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call RemoveListener() with null listener ... ");
result = mgr->RemoveListener(0);
if (result != NS_ERROR_NULL_POINTER) {
@ -1047,7 +1027,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Call RemoveListener() with null listener");
PRInt32 i;
TestTransaction *tximpl;
@ -1063,8 +1043,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test coalescing of transactions ... ");
result = mgr->SetMaxTransactionCount(10);
if (NS_FAILED(result)) {
@ -1211,7 +1189,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Test coalescing of transactions");
/*******************************************************************
*
@ -1220,8 +1198,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Execute 20 transactions ... ");
for (i = 1; i <= 20; i++) {
tximpl = factory->create(mgr, NONE_FLAG);
@ -1275,7 +1251,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Execute 20 transactions");
/*******************************************************************
*
@ -1284,8 +1260,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Execute 20 transient transactions ... ");
u1 = u2 = r1 = r2 = 0;
result = mgr->PeekUndoStack(&u1);
@ -1387,7 +1361,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Execute 20 transient transactions");
/*******************************************************************
*
@ -1396,8 +1370,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Undo 4 transactions ... ");
for (i = 1; i <= 4; i++) {
result = mgr->UndoTransaction();
if (NS_FAILED(result)) {
@ -1434,7 +1406,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Undo 4 transactions");
/*******************************************************************
*
@ -1443,8 +1415,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Redo 2 transactions ... ");
for (i = 1; i <= 2; ++i) {
result = mgr->RedoTransaction();
if (NS_FAILED(result)) {
@ -1481,7 +1451,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Redo 2 transactions");
/*******************************************************************
*
@ -1489,8 +1459,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Check if new transactions prune the redo stack ... ");
tximpl = factory->create(mgr, NONE_FLAG);
if (!tximpl) {
@ -1543,7 +1511,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Check if new transactions prune the redo stack");
/*******************************************************************
*
@ -1551,8 +1519,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Undo 4 transactions then clear the undo and redo stacks ... ");
for (i = 1; i <= 4; ++i) {
result = mgr->UndoTransaction();
if (NS_FAILED(result)) {
@ -1624,7 +1590,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Undo 4 transactions then clear the undo and redo stacks");
/*******************************************************************
*
@ -1632,8 +1598,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Execute 5 transactions ... ");
for (i = 1; i <= 5; i++) {
tximpl = factory->create(mgr, NONE_FLAG);
@ -1687,7 +1651,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Execute 5 transactions");
/*******************************************************************
*
@ -1695,8 +1659,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction DoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_DO_ERROR_FLAG);
if (!tximpl) {
@ -1798,7 +1760,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction DoTransaction() error");
/*******************************************************************
*
@ -1806,8 +1768,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction UndoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_UNDO_ERROR_FLAG);
if (!tximpl) {
@ -1916,7 +1876,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction UndoTransaction() error");
/*******************************************************************
*
@ -1924,8 +1884,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction RedoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_REDO_ERROR_FLAG);
if (!tximpl) {
@ -2080,7 +2038,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction RedoTransaction() error");
/*******************************************************************
*
@ -2090,8 +2048,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test max transaction count of zero ... ");
result = mgr->SetMaxTransactionCount(0);
if (NS_FAILED(result)) {
@ -2180,7 +2136,7 @@ quick_test(TestTransactionFactory *factory)
}
}
printf("passed\n");
passed("Test max transaction count of zero");
/*******************************************************************
*
@ -2190,8 +2146,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test SetMaxTransactionCount() greater than num stack items ... ");
result = mgr->SetMaxTransactionCount(-1);
if (NS_FAILED(result)) {
@ -2373,7 +2327,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test SetMaxTransactionCount() greater than num stack items");
/*******************************************************************
*
@ -2383,8 +2337,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test SetMaxTransactionCount() pruning undo stack ... ");
u1 = u2 = r1 = r2 = 0;
result = mgr->PeekUndoStack(&u1);
@ -2468,7 +2420,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test SetMaxTransactionCount() pruning undo stack");
/*******************************************************************
*
@ -2478,8 +2430,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test SetMaxTransactionCount() pruning redo stack ... ");
u1 = u2 = r1 = r2 = 0;
result = mgr->PeekUndoStack(&u1);
@ -2563,7 +2513,7 @@ quick_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test SetMaxTransactionCount() pruning redo stack");
/*******************************************************************
*
@ -2572,8 +2522,6 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Release the transaction manager ... ");
result = mgr->SetMaxTransactionCount(-1);
if (NS_FAILED(result)) {
@ -2678,7 +2626,7 @@ quick_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Release the transaction manager");
/*******************************************************************
*
@ -2687,16 +2635,14 @@ quick_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Number of transactions created and destroyed match ... ");
if (sConstructorCount != sDestructorCount) {
printf("ERROR: Transaction constructor count (%d) != destructor count (%d).\n",
sConstructorCount, sDestructorCount);
return NS_ERROR_FAILURE;
}
printf("passed\n");
printf("%d transactions processed during quick test.\n", sConstructorCount);
passed("Number of transactions created and destroyed match");
passed("%d transactions processed during quick test", sConstructorCount);
return NS_OK;
}
@ -2774,8 +2720,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Create transaction manager instance ... ");
nsCOMPtr<nsITransactionManager> mgr =
do_CreateInstance(NS_TRANSACTIONMANAGER_CONTRACTID, &result);
if (NS_FAILED(result) || !mgr) {
@ -2783,7 +2727,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_OUT_OF_MEMORY;
}
printf("passed\n");
passed("Create transaction manager instance");
PRInt32 numitems;
@ -2794,8 +2738,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test unbalanced EndBatch() with empty undo stack ... ");
result = mgr->GetNumberOfUndoItems(&numitems);
if (NS_FAILED(result)) {
@ -2831,8 +2773,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test unbalanced EndBatch() with empty undo stack");
/*******************************************************************
*
@ -2841,8 +2782,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test empty batch ... ");
result = mgr->GetNumberOfUndoItems(&numitems);
if (NS_FAILED(result)) {
@ -2899,7 +2838,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test empty batch");
PRInt32 i;
TestTransaction *tximpl;
@ -2912,8 +2851,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Execute 20 batched transactions ... ");
result = mgr->BeginBatch();
if (NS_FAILED(result)) {
@ -2981,7 +2918,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Execute 20 batched transactions");
nsITransaction *u1, *u2;
nsITransaction *r1, *r2;
@ -2993,8 +2930,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Execute 20 batched transient transactions ... ");
u1 = u2 = r1 = r2 = 0;
result = mgr->PeekUndoStack(&u1);
@ -3110,7 +3045,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Execute 20 batched transient transactions");
/*******************************************************************
*
@ -3119,8 +3054,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test nested batched transactions ... ");
result = mgr->BeginBatch();
if (NS_FAILED(result)) {
@ -3285,7 +3218,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test nested batched transactions");
/*******************************************************************
*
@ -3294,8 +3227,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Undo 2 batch transactions ... ");
for (i = 1; i <= 2; ++i) {
result = mgr->UndoTransaction();
if (NS_FAILED(result)) {
@ -3332,7 +3263,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Undo 2 batch transactions");
/*******************************************************************
*
@ -3341,9 +3272,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Redo 2 batch transactions ... ");
for (i = 1; i <= 2; ++i) {
result = mgr->RedoTransaction();
if (NS_FAILED(result)) {
@ -3380,7 +3308,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Redo 2 batch transactions");
/*******************************************************************
*
@ -3389,8 +3317,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Undo a batched transaction that was redone ... ");
result = mgr->UndoTransaction();
if (NS_FAILED(result)) {
@ -3426,7 +3352,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Undo a batched transaction that was redone");
/*******************************************************************
*
@ -3435,8 +3361,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test effect of unbalanced EndBatch() on undo and redo stacks ... ");
result = mgr->EndBatch();
if (result != NS_ERROR_FAILURE) {
@ -3472,7 +3396,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test effect of unbalanced EndBatch() on undo and redo stacks");
/*******************************************************************
*
@ -3482,8 +3406,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test effect of empty batch on undo and redo stacks ... ");
result = mgr->BeginBatch();
if (NS_FAILED(result)) {
@ -3554,9 +3476,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test effect of empty batch on undo and redo stacks");
/*******************************************************************
*
@ -3564,8 +3484,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Check if new batched transactions prune the redo stack ... ");
result = mgr->BeginBatch();
if (NS_FAILED(result)) {
@ -3661,7 +3579,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Check if new batched transactions prune the redo stack");
/*******************************************************************
*
@ -3669,8 +3587,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Call undo ... ");
// Move a transaction over to the redo stack, so that we have one
// transaction on the undo stack, and one on the redo stack!
@ -3709,7 +3625,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Call undo");
/*******************************************************************
*
@ -3717,9 +3633,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction DoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_DO_ERROR_FLAG);
if (!tximpl) {
@ -3835,7 +3748,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction DoTransaction() error");
/*******************************************************************
*
@ -3843,8 +3756,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction UndoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_UNDO_ERROR_FLAG);
if (!tximpl) {
@ -3967,7 +3878,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction UndoTransaction() error");
/*******************************************************************
*
@ -3975,8 +3886,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test transaction RedoTransaction() error ... ");
tximpl = factory->create(mgr, THROWS_REDO_ERROR_FLAG);
if (!tximpl) {
@ -4145,7 +4054,7 @@ quick_batch_test(TestTransactionFactory *factory)
return NS_ERROR_FAILURE;
}
printf("passed\n");
passed("Test transaction RedoTransaction() error");
/*******************************************************************
*
@ -4155,8 +4064,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Test max transaction count of zero ... ");
result = mgr->SetMaxTransactionCount(0);
if (NS_FAILED(result)) {
@ -4259,7 +4166,7 @@ quick_batch_test(TestTransactionFactory *factory)
}
}
printf("passed\n");
passed("Test max transaction count of zero");
/*******************************************************************
*
@ -4268,8 +4175,6 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Release the transaction manager ... ");
result = mgr->SetMaxTransactionCount(-1);
if (NS_FAILED(result)) {
@ -4388,7 +4293,7 @@ quick_batch_test(TestTransactionFactory *factory)
return result;
}
printf("passed\n");
passed("Release the transaction manager");
/*******************************************************************
*
@ -4397,16 +4302,14 @@ quick_batch_test(TestTransactionFactory *factory)
*
*******************************************************************/
printf("Number of transactions created and destroyed match ... ");
if (sConstructorCount != sDestructorCount) {
printf("ERROR: Transaction constructor count (%d) != destructor count (%d).\n",
sConstructorCount, sDestructorCount);
return NS_ERROR_FAILURE;
}
printf("passed\n");
printf("%d transactions processed during quick batch test.\n",
passed("Number of transactions created and destroyed match");
passed("%d transactions processed during quick batch test",
sConstructorCount);
return NS_OK;
@ -4581,6 +4484,8 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
printf("%i ", j);
} // for, iterations.
printf(passed"\n");
result = mgr->Clear();
if (NS_FAILED(result)) {
printf("ERROR: Clear() failed. (%d)\n", result);
@ -4593,9 +4498,7 @@ stress_test(TestTransactionFactory *factory, PRInt32 iterations)
return NS_ERROR_FAILURE;
}
printf("passed\n");
printf("%d transactions processed during stress test.\n", sConstructorCount);
passed("%d transactions processed during stress test", sConstructorCount);
return NS_OK;
}

Просмотреть файл

@ -94,13 +94,21 @@ void fail(const char* msg, ...)
}
/**
* Prints the given string prepending "TEST-PASS | " for the benefit of
* the test harness and with "\n" at the end, to be used at the end of a
* successful test function.
* Prints the given success message and arguments using printf, prepending
* "TEST-PASS " for the benefit of the test harness and
* appending "\n" to eliminate having to type it at each call site.
*/
void passed(const char* test)
void passed(const char* msg, ...)
{
printf("TEST-PASS | %s\n", test);
va_list ap;
printf("TEST-PASS | ");
va_start(ap, msg);
vprintf(msg, ap);
va_end(ap);
putchar('\n');
}
//-----------------------------------------------------------------------------