浏览代码

feat: add more test to pyth lazer protocol (#2943)

Keyvan Khademi 3 月之前
父节点
当前提交
7af416ef97
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      lazer/sdk/rust/protocol/src/price/tests.rs

+ 10 - 0
lazer/sdk/rust/protocol/src/price/tests.rs

@@ -133,6 +133,16 @@ fn price_ops() {
         12.34 * 34.56
     );
 
+    assert_float_absolute_eq!(
+        price1.mul_decimal(34, 2).unwrap().to_f64(-8).unwrap(),
+        12.34 * 3400.0
+    );
+
+    assert_float_absolute_eq!(
+        price1.mul_decimal(34, 0).unwrap().to_f64(-8).unwrap(),
+        12.34 * 34.0
+    );
+
     let price2 = Price::parse_str("42_000", 3).unwrap();
     assert_float_absolute_eq!(
         price2.mul_integer(2).unwrap().to_f64(3).unwrap(),