// }
int ret;
-frsh_contract_t contract[N];
+frsh_contract_t contract[N], c;
frsh_vres_id_t vres[N];
frsh_rel_time_t budget, period, deadline;
int i;
false, &deadline));
ret = WVFRSH(frsh_contract_negotiate(&contract[i], &vres[i]));
+ WVFRSH(frsh_vres_get_contract(vres[i], &c));
+ WVPASS(fres_contract_get_budget(&c, &budget));
+ WVPASS(fosa_rel_time_to_msec(budget) == b[i]);
}
-}
-WVTEST_MAIN("renegotiation")
-{
+ /* 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);
FRSH_CT_REGULAR));
ret = WVFRSH(frsh_contract_renegotiate_sync(&contract[i], vres[i]));
+ WVFRSH(frsh_vres_get_contract(vres[i], &c));
+ WVPASS(fres_contract_get_budget(&c, &budget));
+ 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],
FRSH_CT_REGULAR));
WVPASS(frsh_contract_renegotiate_sync(&contract[2], vres[2]) == FRSH_ERR_CONTRACT_REJECTED);
-}
+ WVFRSH(frsh_vres_get_contract(vres[2], &c));
+ WVPASS(fres_contract_get_budget(&c, &budget));
+ WVPASSEQ(fosa_rel_time_to_msec(budget), b[2]);
-WVTEST_MAIN("cancelation")
-{
/* Cancel N contracts */
for (i=0; i<N; i++) {
ret = WVFRSH(frsh_contract_cancel(vres[i]));