Actual source code: ex33.c

  1: static char help[] = "Tests PetscStack.\n\n";

  3: #include <petscsys.h>

  5: #if !defined(PETSCSTACKSIZE)
  6:   #define PETSCSTACKSIZE 64
  7: #endif

  9: PetscErrorCode correct()
 10: {
 11:   PetscFunctionBegin;
 12:   PetscFunctionReturn(PETSC_SUCCESS);
 13: }

 15: PetscErrorCode correctu()
 16: {
 17:   PetscFunctionBeginUser;
 18:   PetscFunctionReturn(PETSC_SUCCESS);
 19: }

 21: PetscErrorCode foo()
 22: {
 23:   PetscFunctionReturn(PETSC_SUCCESS);
 24: }

 26: PetscErrorCode bar()
 27: {
 28:   PetscFunctionBegin;
 29:   return PETSC_SUCCESS;
 30: }

 32: PetscErrorCode baru()
 33: {
 34:   PetscFunctionBeginUser;
 35:   return PETSC_SUCCESS;
 36: }

 38: int main(int argc, char **argv)
 39: {
 40:   PetscFunctionBeginUser;
 41:   PetscCall(PetscInitialize(&argc, &argv, NULL, help));
 42:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(correct());
 43:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
 44:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(bar());
 45:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
 46:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(baru());
 47:   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
 48:   PetscCall(PetscFinalize());
 49:   return 0;
 50: }

 52: /*TEST

 54:   test:
 55:     TODO: Since this now errors out the test harness can chock on the output

 57: TEST*/