LCOV - code coverage report
Current view: top level - src/ctlib/unittests - connect_fail.c (source / functions) Hit Total Coverage
Test: FreeTDS coverage Lines: 16 18 88.9 %
Date: 2025-01-18 11:50:39 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #include "common.h"
       2             : 
       3             : int
       4           8 : main(void)
       5             : {
       6             :         CS_CONTEXT *ctx;
       7             :         CS_CONNECTION *conn;
       8           8 :         int ret = 1;
       9             : 
      10           8 :         read_login_info();
      11             :         
      12           8 :         check_call(cs_ctx_alloc, (CS_VERSION_100, &ctx));
      13           8 :         check_call(ct_init, (ctx, CS_VERSION_100));
      14           8 :         check_call(ct_con_alloc, (ctx, &conn));
      15           8 :         check_call(ct_con_props, (conn, CS_SET, CS_USERNAME, (CS_VOID*) "sa", CS_NULLTERM, NULL));
      16           8 :         check_call(ct_con_props, (conn, CS_SET, CS_PASSWORD, (CS_VOID*) "invalid", CS_NULLTERM, NULL));
      17           8 :         if (ct_connect(conn, SERVER, CS_NULLTERM) != CS_FAIL) {
      18           0 :                 fprintf(stderr, "Connection succeeded??\n");
      19           0 :                 return ret;
      20             :         }
      21             : 
      22           8 :         check_call(ct_cancel, (conn, NULL, CS_CANCEL_ALL));
      23           8 :         check_call(ct_close, (conn, CS_UNUSED));
      24           8 :         check_call(ct_con_drop, (conn));
      25           8 :         check_call(ct_exit, (ctx, CS_UNUSED));
      26           8 :         check_call(cs_ctx_drop,(ctx));
      27             : 
      28           8 :         printf("Test succeeded\n");
      29           8 :         return 0;
      30             : }

Generated by: LCOV version 1.13