1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /***********************************************************************
8 ** Name: dbmalloc1.c (OBSOLETE)
10 ** Description: Tests PR_SetMallocCountdown PR_ClearMallocCountdown functions.
12 ** Modification History:
13 ** 14-May-97 AGarcia- Converted the test to accomodate the debug_mode flag.
14 ** The debug mode will print all of the printfs associated with this test.
15 ** The regress mode will be the default mode. Since the regress tool limits
16 ** the output to a one line status:PASS or FAIL,all of the printf statements
17 ** have been handled with an if (debug_mode) statement.
18 ** 04-June-97 AGarcia removed the Test_Result function. Regress tool has been updated to
19 ** recognize the return code from tha main program.
21 ** 12-June-97 AGarcia Revert to return code 0 and 1, remove debug option (obsolete).
22 ***********************************************************************/
25 /***********************************************************************
27 ***********************************************************************/
32 PRIntn failed_already=0;
35 /* variable used for both r1 and r2 tests */
37 int actually_failed=0;
48 for( i = 0; i < 5; i++ )
50 void *x = PR_MALLOC(128);
51 if( (void *)0 == x ) {
52 if (debug_mode) printf("\tMalloc %d failed.\n", i+1);
58 if (((should_fail != actually_failed) & (!debug_mode))) failed_already=1;
72 for( i = 0; i <= 5; i++ )
76 if (debug_mode) printf("No malloc should fail:\n");
79 if (debug_mode) printf("Malloc %d should fail:\n", i);
82 PR_SetMallocCountdown(i);
84 PR_ClearMallocCountdown();
88 int main(int argc, char **argv)
93 PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);