xref: /petsc/src/sys/tests/ex33.c (revision 9371c9d470a9602b6d10a8bf50c9b2280a79e45a)
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   PetscFunctionBegin;
11   PetscFunctionReturn(0);
12 }
13 
14 PetscErrorCode correctu() {
15   PetscFunctionBeginUser;
16   PetscFunctionReturn(0);
17 }
18 
19 PetscErrorCode foo() {
20   PetscFunctionReturn(0);
21 }
22 
23 PetscErrorCode bar() {
24   PetscFunctionBegin;
25   return 0;
26 }
27 
28 PetscErrorCode baru() {
29   PetscFunctionBeginUser;
30   return 0;
31 }
32 
33 int main(int argc, char **argv) {
34   PetscFunctionBeginUser;
35   PetscCall(PetscInitialize(&argc, &argv, (char *)0, help));
36   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(correct());
37   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
38   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(bar());
39   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
40   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(baru());
41   for (PetscInt i = 0; i < PETSCSTACKSIZE + 1; i++) PetscCall(foo());
42   PetscCall(PetscFinalize());
43   return 0;
44 }
45 
46 /*TEST
47 
48   test:
49     TODO: Since this now errors out the test harness can chock on the output
50 
51 TEST*/
52