LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/preproc - init.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 46 46 100.0 %
Date: 2024-03-28 08:11:21 Functions: 7 7 100.0 %
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           8 : static int fa(void)
       7             : {
       8           8 :     printf("in fa\n");
       9           8 :     return 2;
      10             : }
      11             : 
      12             : static int
      13           8 : fb(int x)
      14             : {
      15           8 :     printf("in fb (%d)\n", x);
      16           8 :     return x;
      17             : }
      18             : 
      19             : static int
      20           4 : fc(const char *x)
      21             : {
      22           4 :     printf("in fc (%s)\n", x);
      23           4 :     return *x;
      24             : }
      25             : 
      26           4 : static int fd(const char *x,int i)
      27             : {
      28           4 :     printf("in fd (%s, %d)\n", x, i);
      29           4 :     return (*x)*i;
      30             : }
      31             : 
      32           4 : static int fe(enum e x)
      33             : {
      34           4 :     printf("in fe (%d)\n", (int) x);
      35           4 :     return (int)x;
      36             : }
      37             : 
      38           4 : static void sqlnotice(const char *notice, short trans)
      39             : {
      40           4 :     if (!notice)
      41           4 :         notice = "-empty-";
      42           4 :     printf("in sqlnotice (%s, %d)\n", notice, trans);
      43           4 : }
      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           4 : int main(void)
      57             : {
      58           4 :     struct sa x = { 14 },*y = &x;
      59             :     exec sql begin declare section;
      60           4 :         int a=(int)2;
      61           4 :         int b=2+2;
      62           4 :         int b2=(14*7);
      63           4 :         int d=x.member;
      64           4 :         int g=fb(2);
      65           4 :         int i=3^1;
      66           4 :         int j=1?1:2;
      67             : 
      68           4 :         int e=y->member;
      69           4 :         int c=10>>2;
      70           4 :         bool h=2||1;
      71             :         long iay /* = 1L */ ;
      72             :     exec sql end declare section;
      73             : 
      74           4 :     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           4 :     exec sql whenever sqlerror do fa();
      88           4 :     exec sql select now();
      89           8 :     exec sql whenever sqlerror do fb(20);
      90           4 :     exec sql select now();
      91           8 :     exec sql whenever sqlerror do fc("50");
      92           4 :     exec sql select now();
      93           4 :     exec sql whenever sqlerror do fd("50",1);
      94           4 :     exec sql select now();
      95           4 :     exec sql whenever sqlerror do fe(ENUM0);
      96           4 :     exec sql select now();
      97           4 :     exec sql whenever sqlerror do sqlnotice(NULL, NONO);
      98           4 :     exec sql select now();
      99           4 :     return 0;
     100             : }

Generated by: LCOV version 1.14