()
| 443 | |
| 444 | #[test] |
| 445 | fn test_bigint_to_i256() { |
| 446 | let cases = [ |
| 447 | (BigInt::from(0), Some(i256::from(0))), |
| 448 | (BigInt::from(1), Some(i256::from(1))), |
| 449 | (BigInt::from(-1), Some(i256::from(-1))), |
| 450 | ( |
| 451 | BigInt::from_str(i256::MAX.to_string().as_str()).unwrap(), |
| 452 | Some(i256::MAX), |
| 453 | ), |
| 454 | ( |
| 455 | BigInt::from_str(i256::MIN.to_string().as_str()).unwrap(), |
| 456 | Some(i256::MIN), |
| 457 | ), |
| 458 | ( |
| 459 | // Can't fit into i256 |
| 460 | BigInt::from_str((i256::MAX.to_string() + "1").as_str()).unwrap(), |
| 461 | None, |
| 462 | ), |
| 463 | ]; |
| 464 | |
| 465 | for (input, expect) in cases { |
| 466 | let output = bigint_to_i256(&input); |
| 467 | assert_eq!(output, expect); |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | #[test] |
| 472 | fn test_parse_decimal() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…