From a347dd8b979b27e61988d9699773253166716ebc Mon Sep 17 00:00:00 2001 From: Thomas Eizinger Date: Thu, 8 Jul 2021 11:15:14 +1000 Subject: [PATCH] Move helper structs below tests --- swap/src/bin/swap.rs | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/swap/src/bin/swap.rs b/swap/src/bin/swap.rs index 5c39af1d..f14c5ef9 100644 --- a/swap/src/bin/swap.rs +++ b/swap/src/bin/swap.rs @@ -492,28 +492,6 @@ mod tests { use super::*; - struct MaxGiveable { - amounts: Vec, - call_counter: usize, - } - - impl MaxGiveable { - fn new(amounts: Vec) -> Self { - Self { - amounts, - call_counter: 0, - } - } - fn give(&mut self) -> Result { - 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, + call_counter: usize, + } + + impl MaxGiveable { + fn new(amounts: Vec) -> Self { + Self { + amounts, + call_counter: 0, + } + } + fn give(&mut self) -> Result { + 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(),