()
| 3520 | |
| 3521 | #[test] |
| 3522 | fn test_decimal_decoding_fixed256() { |
| 3523 | let dt = avro_from_codec(Codec::Decimal(50, Some(2), Some(32))); |
| 3524 | let mut decoder = Decoder::try_new(&dt).unwrap(); |
| 3525 | let row1 = [ |
| 3526 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3527 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 3528 | 0x00, 0x00, 0x30, 0x39, |
| 3529 | ]; |
| 3530 | let row2 = [ |
| 3531 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 3532 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, |
| 3533 | 0xFF, 0xFF, 0xFF, 0x85, |
| 3534 | ]; |
| 3535 | let mut data = Vec::new(); |
| 3536 | data.extend_from_slice(&row1); |
| 3537 | data.extend_from_slice(&row2); |
| 3538 | let mut cursor = AvroCursor::new(&data); |
| 3539 | decoder.decode(&mut cursor).unwrap(); |
| 3540 | decoder.decode(&mut cursor).unwrap(); |
| 3541 | let arr = decoder.flush(None).unwrap(); |
| 3542 | let dec = arr.as_any().downcast_ref::<Decimal256Array>().unwrap(); |
| 3543 | assert_eq!(dec.len(), 2); |
| 3544 | assert_eq!(dec.value_as_string(0), "123.45"); |
| 3545 | assert_eq!(dec.value_as_string(1), "-1.23"); |
| 3546 | } |
| 3547 | |
| 3548 | #[test] |
| 3549 | fn test_decimal_decoding_fixed128() { |
nothing calls this directly
no test coverage detected