tests: unittest: pass: Use proper type for iteration index 29/280229/2
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 25 Aug 2022 04:57:27 +0000 (13:57 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 30 Aug 2022 00:29:33 +0000 (09:29 +0900)
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 <dwoo08.lee@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
tests/unittest/pass-unittests.cc

index 2942b63..6408468 100644 (file)
@@ -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);