From 15aef3e2ba53fe70dd308ebeab38329b1272aa62 Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Thu, 25 Aug 2022 13:57:27 +0900 Subject: [PATCH] tests: unittest: pass: Use proper type for iteration index This fixes to use proper type for iteration index, and also refactor the part of clear progress with same code for both success and failure cases. Change-Id: Ide70626a93328ef2bc9668addbf4ede73a345dca Signed-off-by: Dongwoo Lee Signed-off-by: Chanwoo Choi --- tests/unittest/pass-unittests.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/unittest/pass-unittests.cc b/tests/unittest/pass-unittests.cc index 2942b63..6408468 100644 --- a/tests/unittest/pass-unittests.cc +++ b/tests/unittest/pass-unittests.cc @@ -519,27 +519,21 @@ TEST(PassParserTest, pass_parser_get_resource_config_invalid) { TEST(PassParserTest, pass_parser_get_each_resource_config_valid) { struct pass pass; const char path_json[] = "./scripts/valid/pass.json"; - unsigned int i; + int i; int ret = pass_parser_get_resource_config(&pass, path_json); ASSERT_EQ(ret, 0); - for (i = 0; i < pass.num_resources; i++) { + for (i = 0; i < (int)pass.num_resources; i++) { struct pass_resource *res = &pass.res[i]; ret = pass_parser_get_each_resource_config(res, res->config_data.path_conf_file); EXPECT_EQ(ret, 0); if (ret < 0) - goto err; + break; } - for (i = 0; i < pass.num_resources; i++) - pass_parser_put_each_resource_config(&pass.res[i]); - pass_parser_put_resource_config(&pass); - - return; -err: for (i--; i >= 0; i--) pass_parser_put_each_resource_config(&pass.res[i]); pass_parser_put_resource_config(&pass); -- 2.7.4