From 67ba6ce1127a1648c45e47dff136b6ad84d370bc Mon Sep 17 00:00:00 2001 From: Grzegorz Kolodziejczyk Date: Wed, 17 Dec 2014 15:01:35 +0100 Subject: [PATCH] android/tester: Refractor properties veryfying Pre condition for properties veryfying is to have set expected properties in step - there is no need to check it inside veryfying function. However veryfying function should check if number of expected or received number of properties is valid. If properties are expected but number of them is 0, test should fail. --- android/tester-main.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/android/tester-main.c b/android/tester-main.c index 152459d30..a8a7bd389 100644 --- a/android/tester-main.c +++ b/android/tester-main.c @@ -501,6 +501,15 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props, int i, j; int exp_prop_to_find = exp_num_props; + if (rec_num_props == 0) + return 1; + + if (exp_num_props == 0) { + tester_debug("Wrong number of expected properties given"); + tester_test_failed(); + return 1; + } + /* Get first exp prop to match and search for it */ for (i = 0; i < exp_num_props; i++) { for (j = 0; j < rec_num_props; j++) { @@ -511,14 +520,6 @@ static int verify_property(bt_property_t *exp_props, int exp_num_props, } } - if ((i == 0) && exp_props) { - tester_warn("No property was verified: %s", exp_num_props ? - "unknown error!" : - "wrong \'.callback_result.num_properties\'?"); - - return 1; - } - return exp_prop_to_find; } -- 2.47.3