Move helper structs below tests

pull/616/head
Thomas Eizinger 3 years ago
parent 7ff57ff0d4
commit a347dd8b97
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96

@ -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…
Cancel
Save