Browse Source

test verifying size of a Trade struct

tags/v0.2.0
Jonathan Strong 4 years ago
parent
commit
b11a950bb1
1 changed files with 18 additions and 0 deletions
  1. +18
    -0
      src/lib.rs

+ 18
- 0
src/lib.rs View File

@@ -49,4 +49,22 @@ mod tests {
Ok(false) Ok(false)
)); ));
} }

#[test]
fn memory_size_of_trades_struct() {
use markets::crypto::{Exchange, Ticker, Side};

struct Trade {
pub time: u64,
pub price: f64,
pub amount: f64,
pub exch: Exchange,
pub ticker: Ticker,
pub server_time: Option<u64>,
pub side: Option<Side>,
}

assert_eq!(std::mem::size_of::<Trade>(), 48);
assert_eq!(std::mem::size_of::<Ticker>(), 2);
}
} }

Loading…
Cancel
Save