mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-31 15:20:15 +00:00
Move helper structs below tests
This commit is contained in:
parent
7ff57ff0d4
commit
a347dd8b97
@ -492,28 +492,6 @@ mod tests {
|
||||
|
||||
use super::*;
|
||||
|
||||
struct MaxGiveable {
|
||||
amounts: Vec<Amount>,
|
||||
call_counter: usize,
|
||||
}
|
||||
|
||||
impl MaxGiveable {
|
||||
fn new(amounts: Vec<Amount>) -> Self {
|
||||
Self {
|
||||
amounts,
|
||||
call_counter: 0,
|
||||
}
|
||||
}
|
||||
fn give(&mut self) -> Result<Amount> {
|
||||
let amount = self
|
||||
.amounts
|
||||
.get(self.call_counter)
|
||||
.ok_or_else(|| anyhow::anyhow!("No more balances available"))?;
|
||||
self.call_counter += 1;
|
||||
Ok(*amount)
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn given_no_balance_and_transfers_less_than_max_swaps_max_giveable() {
|
||||
let _guard = subscriber::set_default(tracing_subscriber::fmt().with_test_writer().finish());
|
||||
@ -712,6 +690,28 @@ mod tests {
|
||||
assert!(matches!(error, tokio::time::error::Elapsed { .. }))
|
||||
}
|
||||
|
||||
struct MaxGiveable {
|
||||
amounts: Vec<Amount>,
|
||||
call_counter: usize,
|
||||
}
|
||||
|
||||
impl MaxGiveable {
|
||||
fn new(amounts: Vec<Amount>) -> Self {
|
||||
Self {
|
||||
amounts,
|
||||
call_counter: 0,
|
||||
}
|
||||
}
|
||||
fn give(&mut self) -> Result<Amount> {
|
||||
let amount = self
|
||||
.amounts
|
||||
.get(self.call_counter)
|
||||
.ok_or_else(|| anyhow::anyhow!("No more balances available"))?;
|
||||
self.call_counter += 1;
|
||||
Ok(*amount)
|
||||
}
|
||||
}
|
||||
|
||||
fn quote_with_max(btc: f64) -> BidQuote {
|
||||
BidQuote {
|
||||
price: Amount::from_btc(0.001).unwrap(),
|
||||
|
Loading…
Reference in New Issue
Block a user