From cf31e1f2788869624a9a363f7579838ddae369a2 Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 26 May 2011 19:55:22 +0200 Subject: finall commit hopefully --- bank-eiffel/account.e | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'bank-eiffel/account.e') diff --git a/bank-eiffel/account.e b/bank-eiffel/account.e index fe9cc3b..a6e30ef 100644 --- a/bank-eiffel/account.e +++ b/bank-eiffel/account.e @@ -81,16 +81,19 @@ feature -- Basic operations require an_authorized_signer_authorized: get_authorized_signers.has (an_authorized_signer) transfer_minamount_ok: an_amount >= transfer_minamount + balance_beneath_creditline: balance - an_amount >= creditline do balance := balance - an_amount ensure + balance_beneath_creditline: balance >= creditline balance_decreased: balance < old balance withdrawed: balance = old balance - an_amount - balance_beneath_creditline: balance >= creditline end transfer(an_amount: like transfer_minamount; an_authorized_signer: PERSON; an_account: like Current; another_authorized_signer: PERSON) + require + recipient_account_not_same: Current /= an_account do withdraw (an_amount, an_authorized_signer) an_account.deposit (an_amount, another_authorized_signer) @@ -107,12 +110,10 @@ feature -- Basic operations remove_authorized_signer (an_authorized_signer: PERSON) require - authorized_signers_never_empty: (get_authorized_signers.has (an_authorized_signer) - and get_authorized_signers.count >= 2) or True + authorized_signer_exists: (get_authorized_signers.has (an_authorized_signer)) + authorized_signers_not_empty: get_authorized_signers.count >= 2 do - if authorized_signers.has (an_authorized_signer) then - authorized_signers.prune (an_authorized_signer) - end + authorized_signers.prune (an_authorized_signer) ensure authorized_signers_assigned: not authorized_signers.has (an_authorized_signer) end -- cgit v1.2.3