[HUST CSE][utest] fix the sizeof incorrect calculation

atoi_tc.c中的"sizeof(test_data[0])" 和atol_tc.c中的"sizeof(test_data1[0]"错误,小于实际数组中的数据个数
This commit is contained in:
连琦 2023-05-14 12:01:44 +08:00 committed by GitHub
parent 92a253c88f
commit 9a77eedd89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ int atoi_entry(void)
{
int i = 0;
int res = 0;
for (i = 0; i < sizeof(test_data[0]); i++)
for (i = 0; i < sizeof(test_data) / sizeof(test_data[0]); i++)
{
res = atoi(test_data[i].string);
uassert_int_equal(res, test_data[i].ret_num);

View File

@ -49,7 +49,7 @@ int atol_entry(void)
{
int i = 0;
int res = 0;
for (i = 0; i < sizeof(test_data1[0]); i++)
for (i = 0; i < sizeof(test_data1) / sizeof(test_data1[0]); i++)
{
res = atol(test_data1[i].string);
uassert_int_equal(res, test_data1[i].ret_num);