LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/test/compat_informix - rfmtlong.pgc (source / functions) Hit Total Coverage
Test: PostgreSQL 13devel Lines: 19 34 55.9 %
Date: 2019-11-21 13:06:38 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          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          40 : fmtlong(long lng, const char *fmt)
      17             : {
      18             :     static int i;
      19             :     int r;
      20             :     char buf[30];
      21             : 
      22          40 :     r = rfmtlong(lng, fmt, buf);
      23          40 :     printf("r: %d ", r);
      24          40 :     if (r == 0)
      25             :     {
      26          40 :         printf("%d: %s (fmt was: %s)\n", i++, buf, fmt);
      27             :     }
      28             :     else
      29           0 :         check_return(r);
      30          40 : }
      31             : 
      32             : int
      33           4 : main(void)
      34             : {
      35           4 :     ECPGdebug(1, stderr);
      36             : 
      37           4 :     fmtlong(-8494493, "-<<<<,<<<,<<<,<<<");
      38           4 :     fmtlong(-8494493, "################");
      39           4 :     fmtlong(-8494493, "+++$$$$$$$$$$$$$.##");
      40           4 :     fmtlong(-8494493, "(&,&&&,&&&,&&&.)");
      41           4 :     fmtlong(-8494493, "<<<<,<<<,<<<,<<<");
      42           4 :     fmtlong(-8494493, "$************.**");
      43           4 :     fmtlong(-8494493, "---$************.**");
      44           4 :     fmtlong(-8494493, "+-+################");
      45           4 :     fmtlong(-8494493, "abc: ################+-+");
      46           4 :     fmtlong(-8494493, "+<<<<,<<<,<<<,<<<");
      47             : 
      48           4 :     return 0;
      49             : }
      50             : 
      51             : static void
      52           0 : check_return(int ret)
      53             : {
      54           0 :     switch(ret)
      55             :     {
      56             :         case ECPG_INFORMIX_ENOTDMY:
      57           0 :             printf("(ECPG_INFORMIX_ENOTDMY)");
      58           0 :             break;
      59             :         case ECPG_INFORMIX_ENOSHORTDATE:
      60           0 :             printf("(ECPG_INFORMIX_ENOSHORTDATE)");
      61           0 :             break;
      62             :         case ECPG_INFORMIX_BAD_DAY:
      63           0 :             printf("(ECPG_INFORMIX_BAD_DAY)");
      64           0 :             break;
      65             :         case ECPG_INFORMIX_BAD_MONTH:
      66           0 :             printf("(ECPG_INFORMIX_BAD_MONTH)");
      67           0 :             break;
      68             :         default:
      69           0 :             printf("(unknown ret: %d)", ret);
      70           0 :             break;
      71             :     }
      72           0 :     printf("\n");
      73           0 : }

Generated by: LCOV version 1.13