LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/compat_informix - rfmtlong.pgc (source / functions) Coverage Total Hit
Test: PostgreSQL 20devel Lines: 48.7 % 39 19
Test Date: 2026-07-25 22:15:46 Functions: 66.7 % 3 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 14.3 % 7 1

             Branch data     Line data    Source code
       1                 :             : #include <stdio.h>
       2                 :             : #include <stdlib.h>
       3                 :             : #include <pgtypes_error.h>
       4                 :             : #include <sqltypes.h>
       5                 :             : 
       6                 :             : /*
       7                 :             :  * This file tests various forms of long-input/output by means of
       8                 :             :  * rfmtlong
       9                 :             :  */
      10                 :             : 
      11                 :             : 
      12                 :             : static void
      13                 :             : check_return(int ret);
      14                 :             : 
      15                 :             : static void
      16                 :          20 : fmtlong(long lng, const char *fmt)
      17                 :             : {
      18                 :             :     static int i;
      19                 :             :     int r;
      20                 :             :     char buf[30];
      21                 :             : 
      22                 :          20 :     r = rfmtlong(lng, fmt, buf);
      23                 :          20 :     printf("r: %d ", r);
      24         [ +  - ]:          20 :     if (r == 0)
      25                 :             :     {
      26                 :          20 :         printf("%d: %s (fmt was: %s)\n", i++, buf, fmt);
      27                 :             :     }
      28                 :             :     else
      29                 :           0 :         check_return(r);
      30                 :          20 : }
      31                 :             : 
      32                 :             : int
      33                 :           2 : main(void)
      34                 :             : {
      35                 :           2 :     ECPGdebug(1, stderr);
      36                 :             : 
      37                 :           2 :     fmtlong(-8494493, "-<<<<,<<<,<<<,<<<");
      38                 :           2 :     fmtlong(-8494493, "################");
      39                 :           2 :     fmtlong(-8494493, "+++$$$$$$$$$$$$$.##");
      40                 :           2 :     fmtlong(-8494493, "(&,&&&,&&&,&&&.)");
      41                 :           2 :     fmtlong(-8494493, "<<<<,<<<,<<<,<<<");
      42                 :           2 :     fmtlong(-8494493, "$************.**");
      43                 :           2 :     fmtlong(-8494493, "---$************.**");
      44                 :           2 :     fmtlong(-8494493, "+-+################");
      45                 :           2 :     fmtlong(-8494493, "abc: ################+-+");
      46                 :           2 :     fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
      47                 :             : 
      48                 :           2 :     return 0;
      49                 :             : }
      50                 :             : 
      51                 :             : static void
      52                 :           0 : check_return(int ret)
      53                 :             : {
      54   [ #  #  #  #  :           0 :     switch(ret)
                      # ]
      55                 :             :     {
      56                 :           0 :         case ECPG_INFORMIX_ENOTDMY:
      57                 :           0 :             printf("(ECPG_INFORMIX_ENOTDMY)");
      58                 :           0 :             break;
      59                 :           0 :         case ECPG_INFORMIX_ENOSHORTDATE:
      60                 :           0 :             printf("(ECPG_INFORMIX_ENOSHORTDATE)");
      61                 :           0 :             break;
      62                 :           0 :         case ECPG_INFORMIX_BAD_DAY:
      63                 :           0 :             printf("(ECPG_INFORMIX_BAD_DAY)");
      64                 :           0 :             break;
      65                 :           0 :         case ECPG_INFORMIX_BAD_MONTH:
      66                 :           0 :             printf("(ECPG_INFORMIX_BAD_MONTH)");
      67                 :           0 :             break;
      68                 :           0 :         default:
      69                 :           0 :             printf("(unknown ret: %d)", ret);
      70                 :           0 :             break;
      71                 :             :     }
      72                 :           0 :     printf("\n");
      73                 :           0 : }
        

Generated by: LCOV version 2.0-1