]> rtime.felk.cvut.cz Git - frescor/frsh-forb.git/blobdiff - src/frsh/frsh_api/tests/negotiation.c
frsh: Update negotiation test
[frescor/frsh-forb.git] / src / frsh / frsh_api / tests / negotiation.c
index 69a000bd78f3ebb5de5832b703e4ac081144a05a..8d45b9d441974d5f10f1ce4df23150c3490ea571 100644 (file)
@@ -74,7 +74,7 @@ WVTEST_MAIN("basic negotiation")
                WVPASS(fosa_rel_time_to_msec(budget) == b[i]);
        }
 
-       /* Renegotiate the contracts */
+       /* Renegotiate the first two contracts */
        for (i=0; i<2; i++) {
                budget = fosa_msec_to_rel_time(2*b[i]);
                period = fosa_msec_to_rel_time(110);
@@ -90,6 +90,7 @@ WVTEST_MAIN("basic negotiation")
                WVPASS(fosa_rel_time_to_msec(budget) == 2*b[i]);
        }
 
+       /* Try to renegotiate the third contract - it will be rejected */
        budget = fosa_msec_to_rel_time(2*b[2]);
        period = fosa_msec_to_rel_time(110);
        ret = WVFRSH(frsh_contract_set_basic_params(&contract[2],
@@ -99,9 +100,9 @@ WVTEST_MAIN("basic negotiation")
                                                    FRSH_CT_REGULAR));
 
        WVPASS(frsh_contract_renegotiate_sync(&contract[2], vres[2]) == FRSH_ERR_CONTRACT_REJECTED);
-       WVFRSH(frsh_vres_get_contract(vres[i], &c));
+       WVFRSH(frsh_vres_get_contract(vres[2], &c));
        WVPASS(fres_contract_get_budget(&c, &budget));
-       WVPASS(fosa_rel_time_to_msec(budget) == b[i]);
+       WVPASSEQ(fosa_rel_time_to_msec(budget), b[2]);
 
        /* Cancel N contracts */
        for (i=0; i<N; i++) {