1pub mod mexc {
3 include!(concat!(env!("OUT_DIR"), "/mexc.rs"));
4}
5
6pub use mexc::*;
8pub use prost;
9
10#[cfg(test)]
11mod tests {
12 use super::*;
13
14 #[test]
15 fn test_protobuf_structs() {
16 let ticker = PublicBookTickerV3Api {
18 bid_price: "100.0".to_string(),
19 bid_quantity: "10.0".to_string(),
20 ask_price: "101.0".to_string(),
21 ask_quantity: "5.0".to_string(),
22 };
23
24 assert_eq!(ticker.bid_price, "100.0");
25 assert_eq!(ticker.ask_price, "101.0");
26 }
27
28 #[test]
29 fn test_serde_serialization() {
30 let ticker = PublicBookTickerV3Api {
32 bid_price: "100.0".to_string(),
33 bid_quantity: "10.0".to_string(),
34 ask_price: "101.0".to_string(),
35 ask_quantity: "5.0".to_string(),
36 };
37
38 let json = serde_json::to_string(&ticker).expect("Serialization failed");
39 let deserialized: PublicBookTickerV3Api = serde_json::from_str(&json).expect("Deserialization failed");
40
41 assert_eq!(ticker.bid_price, deserialized.bid_price);
42 assert_eq!(ticker.ask_price, deserialized.ask_price);
43 }
44}