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

Correction of test_codbc138 test. It could fail

with some compilers(observed with VS). That would happen in memcmp of 2 MYSQL_TIME structures. Apparently because different
content of memory areas the compiler used to pad structures.
This commit is contained in:
Lawrin Novitsky
2018-11-08 15:42:25 +01:00
parent f1ef0d1ff2
commit 738e4fa86f

View File

@@ -4651,6 +4651,13 @@ static int test_compress(MYSQL *mysql)
return OK;
}
static int equal_MYSQL_TIME(MYSQL_TIME *tm1, MYSQL_TIME *tm2)
{
return tm1->day==tm1->day && tm1->hour==tm1->hour && tm1->minute==tm1->minute &&
tm1->month==tm1->month && tm1->neg==tm1->neg && tm1->second==tm1->second &&
tm1->second_part==tm1->second_part && tm1->time_type==tm1->time_type && tm1->year==tm1->year;
}
static int test_codbc138(MYSQL *mysql)
{
int rc;
@@ -4711,7 +4718,7 @@ static int test_codbc138(MYSQL *mysql)
FAIL_UNLESS(tm.time_type == MYSQL_TIMESTAMP_ERROR, "MYSQL_TIMESTAMP_ERROR expected");
}
else
FAIL_UNLESS(memcmp(&tm, &time_test[i].tm, sizeof(MYSQL_TIME)) == 0, "time_in != time_out");
FAIL_UNLESS(equal_MYSQL_TIME(&tm, &time_test[i].tm), "time_in != time_out");
mysql_stmt_close(stmt);
i++;
}