1 static char help[] = "Tests PetscStack.\n\n"; 2 3 #include <petscsys.h> 4 5 #if !defined(PETSCSTACKSIZE) 6 #define PETSCSTACKSIZE 64 7 #endif 8 9 PetscErrorCode correct() 10 { 11 PetscFunctionBegin; 12 PetscFunctionReturn(0); 13 } 14 15 PetscErrorCode correctu() 16 { 17 PetscFunctionBeginUser; 18 PetscFunctionReturn(0); 19 } 20 21 PetscErrorCode foo() 22 { 23 PetscFunctionReturn(0); 24 } 25 26 PetscErrorCode bar() 27 { 28 PetscFunctionBegin; 29 return 0; 30 } 31 32 PetscErrorCode baru() 33 { 34 PetscFunctionBeginUser; 35 return 0; 36 } 37 38 int main(int argc,char **argv) 39 { 40 PetscErrorCode ierr; 41 PetscBool flg = PETSC_FALSE; 42 43 ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; 44 #if defined(PETSC_USE_DEBUG) 45 CHKERRQ(PetscOptionsGetBool(NULL,NULL,"-checkstack",&flg,NULL)); 46 #endif 47 CHKERRQ(PetscPrintf(PETSC_COMM_WORLD,"%s for stack\n",flg ? "Checking" : "Not checking")); 48 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(correct()); 49 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(foo()); 50 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(bar()); 51 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(foo()); 52 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(baru()); 53 for (PetscInt i = 0; i < PETSCSTACKSIZE+1; i++) CHKERRQ(foo()); 54 ierr = PetscFinalize(); 55 return ierr; 56 } 57 58 /*TEST 59 60 test: 61 62 TEST*/ 63