[bitshares/bitshares-core] Fix tests (#1126)

nathanhourt commented on this pull request.

> @@ -248,6 +248,11 @@ void_result call_order_update_evaluator::do_apply(const call_order_update_operat
call_obj = &*itr;
old_collateralization = call_obj->collateralization();
old_debt = call_obj->debt;
+ auto new_collateral = call_obj->collateral + o.delta_collateral.amount;
+ auto new_debt = *old_debt + o.delta_debt.amount;
+ // Forbid zero collateral with nonzero debt (avoids divide by zero when calculating call price below)
+ FC_ASSERT(!(new_collateral == 0 && new_debt != 0), «Cannot have zero collateral and nonzero debt»);

Incorrect. The test fails, because boost captures the division by zero exception, as it occurs inside the modify functor (line 257), triggering the object to be deleted. As per boost docs, this is expected behavior:

> https://www.boost.org/doc/libs/1_67_0/libs/multi_index/doc/reference/ord_indices.html#modify
> **Exception safety:** Basic. If an exception is thrown by some user-provided operation (including mod), then the element pointed to by position is erased.

Добавить комментарий