LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/preproc - init.pgc (source / functions) Coverage Total Hit
Test: PostgreSQL 19devel Lines: 100.0 % 46 46
Test Date: 2026-03-03 05:14:59 Functions: 100.0 % 7 7
Legend: Lines:     hit not hit

            Line data    Source code
       1              : exec sql include sqlca;
       2              : 
       3              : enum e { ENUM0, ENUM1 };
       4              : struct sa { int member; };
       5              : 
       6            4 : static int fa(void)
       7              : {
       8            4 :     printf("in fa\n");
       9            4 :     return 2;
      10              : }
      11              : 
      12              : static int
      13            4 : fb(int x)
      14              : {
      15            4 :     printf("in fb (%d)\n", x);
      16            4 :     return x;
      17              : }
      18              : 
      19              : static int
      20            2 : fc(const char *x)
      21              : {
      22            2 :     printf("in fc (%s)\n", x);
      23            2 :     return *x;
      24              : }
      25              : 
      26            2 : static int fd(const char *x,int i)
      27              : {
      28            2 :     printf("in fd (%s, %d)\n", x, i);
      29            2 :     return (*x)*i;
      30              : }
      31              : 
      32            2 : static int fe(enum e x)
      33              : {
      34            2 :     printf("in fe (%d)\n", (int) x);
      35            2 :     return (int)x;
      36              : }
      37              : 
      38            2 : static void sqlnotice(const char *notice, short trans)
      39              : {
      40            2 :     if (!notice)
      41            2 :         notice = "-empty-";
      42            2 :     printf("in sqlnotice (%s, %d)\n", notice, trans);
      43            2 : }
      44              : 
      45              : exec sql define NONO 0;
      46              : 
      47              : #define YES 1
      48              : 
      49              : #ifdef _cplusplus
      50              : namespace N
      51              : {
      52              :     static const int i=2;
      53              : };
      54              : #endif
      55              : 
      56            2 : int main(void)
      57              : {
      58            2 :     struct sa x = { 14 },*y = &x;
      59              :     exec sql begin declare section;
      60            2 :         int a=(int)2;
      61            2 :         int b=2+2;
      62            2 :         int b2=(14*7);
      63            2 :         int d=x.member;
      64            2 :         int g=fb(2);
      65            2 :         int i=3^1;
      66            2 :         int j=1?1:2;
      67              : 
      68            2 :         int e=y->member;
      69            2 :         int c=10>>2;
      70            2 :         bool h=2||1;
      71              :         long iay /* = 1L */ ;
      72              :     exec sql end declare section;
      73              : 
      74            2 :     int f=fa();
      75              : 
      76              : #ifdef _cplusplus
      77              :     exec sql begin declare section;
      78              :     int k=N::i; /* compile error */
      79              :     exec sql end declare section;
      80              : #endif
      81              : 
      82              :     ECPGdebug(1, stderr);
      83              : 
      84              :     printf("%d %d %d %d %d %d %d %d %d %d %d\n", a, b, b2, c, d, e, f, g, h, i, j);
      85              :     iay = 0;
      86              :     printf("%ld\n", iay);
      87            2 :     exec sql whenever sqlerror do fa();
      88            2 :     exec sql select now();
      89            4 :     exec sql whenever sqlerror do fb(20);
      90            2 :     exec sql select now();
      91            4 :     exec sql whenever sqlerror do fc("50");
      92            2 :     exec sql select now();
      93            2 :     exec sql whenever sqlerror do fd("50",1);
      94            2 :     exec sql select now();
      95            2 :     exec sql whenever sqlerror do fe(ENUM0);
      96            2 :     exec sql select now();
      97            2 :     exec sql whenever sqlerror do sqlnotice(NULL, NONO);
      98            2 :     exec sql select now();
      99            2 :     return 0;
     100              : }
        

Generated by: LCOV version 2.0-1