1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Test bugs fixes

This commit is contained in:
Anton Golovenko
2021-01-18 14:55:54 +05:00
parent 4083fd98e5
commit a7e888b518
5 changed files with 14 additions and 20 deletions

View File

@@ -881,7 +881,7 @@ static int test_get_options(MYSQL *unused __attribute__((unused)))
const char *attr_val[] = {"bar1", "bar2", "bar3"}; const char *attr_val[] = {"bar1", "bar2", "bar3"};
char **key, **val; char **key, **val;
for (i=0; options_int[i]; i++) for (i=0; i < sizeof(options_int)/sizeof(int); i++)
{ {
mysql_options(mysql, options_int[i], &intval[0]); mysql_options(mysql, options_int[i], &intval[0]);
intval[1]= 0; intval[1]= 0;

View File

@@ -291,7 +291,7 @@ static int test_frm_bug(MYSQL *mysql)
rc= 0; rc= 0;
while (mysql_fetch_row(result)) while (mysql_fetch_row(result))
rc++; rc++;
FAIL_UNLESS(rc == 1, "rowcount != 0"); FAIL_UNLESS(rc == 1, "rowcount != 1");
mysql_data_seek(result, 0); mysql_data_seek(result, 0);

View File

@@ -138,9 +138,6 @@ static int test_prepare_insert_update(MYSQL *mysql)
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql);
for (cur_query= testcase; *cur_query; cur_query++) for (cur_query= testcase; *cur_query; cur_query++)
{ {
char query[MAX_TEST_QUERY_LENGTH]; char query[MAX_TEST_QUERY_LENGTH];
@@ -182,7 +179,7 @@ static int test_prepare_insert_update(MYSQL *mysql)
static int test_bind_date_conv(MYSQL *mysql, uint row_count) static int test_bind_date_conv(MYSQL *mysql, uint row_count)
{ {
MYSQL_STMT *stmt= 0; MYSQL_STMT *stmt= 0;
uint rc, i, count= row_count; uint rc, i, count;
MYSQL_BIND my_bind[4]; MYSQL_BIND my_bind[4];
my_bool is_null[4]= {0,0,0,0}; my_bool is_null[4]= {0,0,0,0};
MYSQL_TIME tm[4]; MYSQL_TIME tm[4];
@@ -1019,7 +1016,7 @@ static int test_select_show(MYSQL *mysql)
strcpy(query, "show columns from test_show"); strcpy(query, "show columns from test_show");
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
FAIL_IF(!stmt, mysql_error(mysql)); FAIL_IF(!stmt, mysql_stmt_error(stmt));
rc= mysql_stmt_prepare(stmt, SL(query)); rc= mysql_stmt_prepare(stmt, SL(query));
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
@@ -3003,7 +3000,7 @@ static int test_create_drop(MYSQL *mysql)
check_stmt_rc(rc, stmt_drop); check_stmt_rc(rc, stmt_drop);
rc= mysql_stmt_execute(stmt_create_select); rc= mysql_stmt_execute(stmt_create_select);
check_stmt_rc(rc, stmt_create); check_stmt_rc(rc, stmt_create_select);
rc= mysql_stmt_execute(stmt_select); rc= mysql_stmt_execute(stmt_select);
check_stmt_rc(rc, stmt_select); check_stmt_rc(rc, stmt_select);

View File

@@ -449,7 +449,7 @@ static int test_bug11037(MYSQL *mysql)
/* expected error */ /* expected error */
rc = mysql_stmt_fetch(stmt); rc = mysql_stmt_fetch(stmt);
FAIL_UNLESS(rc==1, "Error expedted"); FAIL_UNLESS(rc==1, "Error expected");
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
@@ -542,7 +542,7 @@ static int test_bug12744(MYSQL *mysql)
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_stmt_rc(rc, stmt);
return OK; return OK;
} }
@@ -724,7 +724,7 @@ static int test_bug15518(MYSQL *mysql)
succeeds succeeds
*/ */
rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12); rc= mysql_stmt_prepare(stmt, "SHOW STATUS", 12);
FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error expected"); FAIL_UNLESS(!rc || mysql_stmt_errno(stmt) || mysql_errno(mysql), "Error not expected");
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_mysql_rc(rc, mysql);
@@ -787,7 +787,7 @@ static int test_bug15613(MYSQL *mysql)
metadata= mysql_stmt_result_metadata(stmt); metadata= mysql_stmt_result_metadata(stmt);
field= mysql_fetch_fields(metadata); field= mysql_fetch_fields(metadata);
FAIL_UNLESS(field[0].length == 65535, "length != 65535"); FAIL_UNLESS(field[0].length == 65535, "length != 65535");
FAIL_UNLESS(field[1].length == 255, "length != 244"); FAIL_UNLESS(field[1].length == 255, "length != 255");
FAIL_UNLESS(field[2].length == 16777215, "length != 166777215"); FAIL_UNLESS(field[2].length == 16777215, "length != 166777215");
FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL"); FAIL_UNLESS(field[3].length == 4294967295UL, "length != 4294967295UL");
FAIL_UNLESS(field[4].length == 255, "length != 255"); FAIL_UNLESS(field[4].length == 255, "length != 255");
@@ -4319,7 +4319,7 @@ static int test_conc182(MYSQL *mysql)
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
rc= mysql_stmt_close(stmt); rc= mysql_stmt_close(stmt);
check_mysql_rc(rc, mysql); check_stmt_rc(rc, stmt);
rc= mysql_query(mysql, "SELECT row_count()"); rc= mysql_query(mysql, "SELECT row_count()");
result= mysql_store_result(mysql); result= mysql_store_result(mysql);
@@ -4527,8 +4527,8 @@ static int test_conc205(MYSQL *mysql)
FAIL_IF(length[2] != 4, "Wrong fetched int length"); FAIL_IF(length[2] != 4, "Wrong fetched int length");
FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value"); FAIL_IF(strncmp(data, "data2", length[0] + 1) != 0, "Wrong string value");
FAIL_IF(smint_col != -25734, "Expected 21893"); FAIL_IF(smint_col != -25734, "Expected -25734");
FAIL_IF(int_col != -1857802040, "Expected 1718038908"); FAIL_IF(int_col != -1857802040, "Expected -1857802040");
rc= mysql_stmt_fetch(stmt); rc= mysql_stmt_fetch(stmt);
FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA"); FAIL_IF(rc != MYSQL_NO_DATA, "Expected MYSQL_NO_DATA");
@@ -4836,9 +4836,6 @@ static int test_codbc138(MYSQL *mysql)
{0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME}, {0,0,0, 838,59,59, 0, 1, MYSQL_TIMESTAMP_TIME},
}, },
{"SELECT '00:60:00'",
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
},
{"SELECT '00:60:00'", {"SELECT '00:60:00'",
{0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR}, {0,0,0, 0,0,0, 0,0, MYSQL_TIMESTAMP_ERROR},
}, },
@@ -4983,8 +4980,8 @@ static int test_conc_fraction(MYSQL *mysql)
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
rc = mysql_stmt_store_result(stmt);
check_stmt_rc(rc, stmt); check_stmt_rc(rc, stmt);
rc= mysql_stmt_store_result(stmt);
memset(bind, 0, sizeof(MYSQL_BIND)); memset(bind, 0, sizeof(MYSQL_BIND));
bind[0].buffer_type= MYSQL_TYPE_DATETIME; bind[0].buffer_type= MYSQL_TYPE_DATETIME;

View File

@@ -120,7 +120,7 @@ static int test_multi_result(MYSQL *mysql)
rc= mysql_stmt_fetch(stmt); rc= mysql_stmt_fetch(stmt);
FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields"); FAIL_IF(mysql_stmt_field_count(stmt) != 2, "expected 2 fields");
FAIL_IF(int_data[0] != 200 || int_data[1] != 300, FAIL_IF(int_data[0] != 200 || int_data[1] != 300,
"expected 100 200 300"); "expected 200 300");
FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results"); FAIL_IF(mysql_stmt_next_result(stmt) != 0, "expected more results");
FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields"); FAIL_IF(mysql_stmt_field_count(stmt) != 0, "expected 0 fields");