LCOV - code coverage report
Current view: top level - src/odbc/unittests - wchar.c (source / functions) Hit Total Coverage
Test: FreeTDS coverage Lines: 13 16 81.2 %
Date: 2025-04-23 23:01:24 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "common.h"
       2             : 
       3             : /* test SQL_C_DEFAULT with NCHAR type */
       4             : 
       5          10 : TEST_MAIN()
       6             : {
       7             :         char buf[102];
       8             :         SQLLEN ind;
       9          10 :         int failed = 0;
      10             : 
      11          10 :         odbc_use_version3 = 1;
      12          10 :         odbc_connect();
      13             : 
      14          10 :         CHKBindCol(1, SQL_C_DEFAULT, buf, 100, &ind, "S");
      15          10 :         odbc_command("SELECT CONVERT(NCHAR(10), 'Pippo 123')");
      16             : 
      17             :         /* get data */
      18          10 :         memset(buf, 0, sizeof(buf));
      19          10 :         CHKFetch("S");
      20             : 
      21          10 :         SQLMoreResults(odbc_stmt);
      22          10 :         SQLMoreResults(odbc_stmt);
      23             : 
      24          10 :         odbc_disconnect();
      25             : 
      26             :         /* the second string could came from Sybase configured with UTF-8 */
      27          10 :         if (strcmp(buf, "Pippo 123 ") != 0
      28           0 :             && (odbc_db_is_microsoft() || strcmp(buf, "Pippo 123                     ") != 0)) {
      29           0 :                 fprintf(stderr, "Wrong results '%s'\n", buf);
      30           0 :                 failed = 1;
      31             :         }
      32             : 
      33          10 :         return failed ? 1 : 0;
      34             : }
      35             : 

Generated by: LCOV version 1.13