From 9a77eedd8968e07bdab65493529a9dd120bb9370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=9E=E7=90=A6?= Date: Sun, 14 May 2023 12:01:44 +0800 Subject: [PATCH] [HUST CSE][utest] fix the sizeof incorrect calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit atoi_tc.c中的"sizeof(test_data[0])" 和atol_tc.c中的"sizeof(test_data1[0]"错误,小于实际数组中的数据个数 --- examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c | 2 +- examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c index ede3525d78..540d297cb0 100644 --- a/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c +++ b/examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c @@ -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); diff --git a/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c b/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c index a2a954d3a8..18567920b8 100644 --- a/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c +++ b/examples/utest/testcases/posix/stdlib_h/functions/atol_tc.c @@ -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);