MCPcopy Create free account
hub / github.com/apache/datafusion / test_bigint_to_i256

Function test_bigint_to_i256

datafusion/sql/src/expr/value.rs:445–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 4

from_strFunction · 0.85
bigint_to_i256Function · 0.85
as_strMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…