Skip to content

Commit

Permalink
backstop: added back overwithdraw test
Browse files Browse the repository at this point in the history
  • Loading branch information
markuspluna committed Oct 25, 2023
1 parent 26c9ab1 commit 4db82ff
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions backstop/src/backstop/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,43 @@ mod tests {
// verify exp is respected when specified
user.dequeue_shares_for_withdrawal(&e, to_dequeue, true);
}
#[test]
#[should_panic(expected = "Error(Contract, #2)")]
fn test_try_withdraw_shares_over_total() {
let e = Env::default();

let cur_q4w = vec![
&e,
Q4W {
amount: 125,
exp: 10000000,
},
Q4W {
amount: 200,
exp: 12592000,
},
Q4W {
amount: 50,
exp: 19592000,
},
];
let mut user = UserBalance {
shares: 1000,
q4w: cur_q4w.clone(),
};

e.ledger().set(LedgerInfo {
protocol_version: 20,
sequence_number: 1,
timestamp: 11192000,
network_id: Default::default(),
base_reserve: 10,
min_temp_entry_expiration: 10,
min_persistent_entry_expiration: 10,
max_entry_expiration: 2000000,
});

let to_dequeue = 376;
user.dequeue_shares_for_withdrawal(&e, to_dequeue, false);
}
}

0 comments on commit 4db82ff

Please sign in to comment.