@@ -287,7 +287,7 @@ mod math_functions {
287
287
Value :: Number ( Number :: from_f64( 100.0 ) . expect( "should create float number" ) ) ,
288
288
Value :: Number ( Number :: from_f64( 3.0 ) . expect( "should create float number" ) ) ,
289
289
Value :: Number (
290
- Number :: from_f64( 33.333333333333336 ) . expect( "should create float number" ) ,
290
+ Number :: from_f64( 33.333_333_333_333_336 ) . expect( "should create float number" ) ,
291
291
) ,
292
292
) ,
293
293
(
@@ -1088,7 +1088,6 @@ mod control_flow_and_logic {
1088
1088
1089
1089
mod string_and_array {
1090
1090
use super :: * ;
1091
-
1092
1091
#[ test]
1093
1092
fn test_in_eval ( ) {
1094
1093
let input = get_default_input ( ) ;
@@ -1309,38 +1308,24 @@ mod string_and_array {
1309
1308
#[ test]
1310
1309
fn test_get_dai_price_in_usd_eval ( ) {
1311
1310
let mut input = get_default_input ( ) ;
1312
- input. global . channel . deposit_asset =
1313
- "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359" . to_string ( ) ;
1311
+
1314
1312
let mut output = Output {
1315
1313
show : true ,
1316
1314
boost : 1.0 ,
1317
1315
price : Default :: default ( ) ,
1318
1316
} ;
1319
-
1317
+ for ( key, value) in & * DEPOSIT_ASSETS_MAP {
1318
+ input. global . channel . deposit_asset = key. to_string ( ) ;
1319
+ let amount_crypto = BigNum :: from ( 100 ) . mul ( value) ;
1320
+ let amount_usd = Some ( Value :: BigNum ( BigNum :: from ( 100 ) ) ) ;
1321
+ let rule = Rule :: Function ( Function :: new_get_price_in_usd ( Rule :: Value ( Value :: BigNum ( amount_crypto) ) ) ) ;
1322
+ assert_eq ! ( Ok ( amount_usd) , rule. eval( & input, & mut output) ) ;
1323
+ }
1320
1324
let amount_dai = BigNum :: from_str ( "100000000000000000000" ) . expect ( "Should create BigNum" ) ; // 100 DAI
1321
1325
let amount_usd = Some ( Value :: BigNum ( BigNum :: from ( 100 ) ) ) ;
1322
1326
let rule = Rule :: Function ( Function :: new_get_price_in_usd ( Rule :: Value ( Value :: BigNum (
1323
1327
amount_dai,
1324
1328
) ) ) ) ;
1325
1329
assert_eq ! ( Ok ( amount_usd) , rule. eval( & input, & mut output) ) ;
1326
1330
}
1327
-
1328
- #[ test]
1329
- fn test_get_tether_price_in_usd_eval ( ) {
1330
- let mut input = get_default_input ( ) ;
1331
- input. global . channel . deposit_asset =
1332
- "0xdac17f958d2ee523a2206206994597c13d831ec7" . to_string ( ) ;
1333
- let mut output = Output {
1334
- show : true ,
1335
- boost : 1.0 ,
1336
- price : Default :: default ( ) ,
1337
- } ;
1338
-
1339
- let amount_tether = BigNum :: from_str ( "100000000" ) . expect ( "Should create BigNum" ) ; // 100 Tether
1340
- let amount_usd = Some ( Value :: BigNum ( BigNum :: from ( 100 ) ) ) ;
1341
- let rule = Rule :: Function ( Function :: new_get_price_in_usd ( Rule :: Value ( Value :: BigNum (
1342
- amount_tether,
1343
- ) ) ) ) ;
1344
- assert_eq ! ( Ok ( amount_usd) , rule. eval( & input, & mut output) ) ;
1345
- }
1346
1331
}
0 commit comments