diff options
| author | 连琦 <[email protected]> | 2023-05-14 12:01:44 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-14 00:01:44 -0400 |
| commit | 9a77eedd8968e07bdab65493529a9dd120bb9370 (patch) | |
| tree | 7035acecd9aea97356c5f8a0c281e9ae010f6265 | |
| parent | 92a253c88fed533117ed91e2bfe9ccb5da7a2c1f (diff) | |
[HUST CSE][utest] fix the sizeof incorrect calculation
atoi_tc.c中的"sizeof(test_data[0])" 和atol_tc.c中的"sizeof(test_data1[0]"错误,小于实际数组中的数据个数
| -rw-r--r-- | examples/utest/testcases/posix/stdlib_h/functions/atoi_tc.c | 2 | ||||
| -rw-r--r-- | 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); |
