From: Yunhee Seo Date: Tue, 19 Sep 2023 05:31:42 +0000 (+0900) Subject: tests: Fix wrong array size for test pattern array initialization X-Git-Tag: accepted/tizen/7.0/unified/20230922.162630~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7845d27f31f7a97f9ceb6b9f87bedf014a09e8bc;p=platform%2Fcore%2Fsystem%2Flibsvi.git tests: Fix wrong array size for test pattern array initialization There are arrays which used for keeping enum id of supported/not supported patterns in INIT_PATTERN_LIST() from tests. However, arrays were being used inappropriately. Therefore, arrays type and initialization size are fixed. Change-Id: I1f8d3cb9a800414177572c9182f5a29843c12788 Signed-off-by: Yunhee Seo --- diff --git a/tests/test-feedback.c b/tests/test-feedback.c index 5cf7164..96e3e16 100644 --- a/tests/test-feedback.c +++ b/tests/test-feedback.c @@ -123,7 +123,7 @@ bool TEST_FEEDBACK_PLAY(void) REPORT_AND_RETURN(); } -static void INIT_PATTERN_LIST(feedback_type_e type, feedback_pattern_e *supported, int *nsupported, feedback_pattern_e *not_supported, int *n_not_supported) +static void INIT_PATTERN_LIST(feedback_type_e type, int *supported, int *nsupported, int *not_supported, int *n_not_supported) { int idx_supported = 0, idx_not_supported = 0; int i; @@ -132,8 +132,8 @@ static void INIT_PATTERN_LIST(feedback_type_e type, feedback_pattern_e *supporte if (!supported || !not_supported) return; - memset(supported, -1, ARRAY_SIZE(test_pattern)); - memset(not_supported, -1, ARRAY_SIZE(test_pattern)); + memset(supported, -1, ARRAY_SIZE(test_pattern) * sizeof(int)); + memset(not_supported, -1, ARRAY_SIZE(test_pattern) * sizeof(int)); feedback_initialize(); @@ -150,7 +150,7 @@ static void INIT_PATTERN_LIST(feedback_type_e type, feedback_pattern_e *supporte if (n_not_supported) *n_not_supported = idx_not_supported; } -static void test_play_type_p(feedback_type_e type, feedback_pattern_e *supported, int ncount) +static void test_play_type_p(feedback_type_e type, int *supported, int ncount) { int i; @@ -159,12 +159,13 @@ static void test_play_type_p(feedback_type_e type, feedback_pattern_e *supported feedback_initialize(); for (i = 0; i < ncount; i++) { - RESULT(feedback_play_type(type, test_pattern[supported[i]].pattern), FEEDBACK_ERROR_NONE, test_pattern[supported[i]].name); + RESULT(feedback_play_type(type, test_pattern[(feedback_pattern_e)supported[i]].pattern), + FEEDBACK_ERROR_NONE, test_pattern[(feedback_pattern_e)supported[i]].name); } feedback_deinitialize(); } -static void test_play_type_n(feedback_type_e type, feedback_pattern_e *notsupported, int ncount) +static void test_play_type_n(feedback_type_e type, int *notsupported, int ncount) { int i; @@ -175,7 +176,8 @@ static void test_play_type_n(feedback_type_e type, feedback_pattern_e *notsuppor feedback_initialize(); for (i = 0; i < ncount; i++) { - RESULT(feedback_play_type(type, test_pattern[notsupported[i]].pattern), FEEDBACK_ERROR_NOT_SUPPORTED, test_pattern[notsupported[i]].name); + RESULT(feedback_play_type(type, test_pattern[(feedback_pattern_e)notsupported[i]].pattern), + FEEDBACK_ERROR_NOT_SUPPORTED, test_pattern[(feedback_pattern_e)notsupported[i]].name); } feedback_deinitialize(); }