MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_array_max_dimensions

Function test_array_max_dimensions

src/repr/src/row.rs:3806–3838  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3804
3805 #[mz_ore::test]
3806 fn test_array_max_dimensions() {
3807 let mut row = Row::default();
3808 let max_dims = usize::from(MAX_ARRAY_DIMENSIONS);
3809
3810 // An array with one too many dimensions should be rejected.
3811 let res = row.packer().try_push_array(
3812 &vec![
3813 ArrayDimension {
3814 lower_bound: 1,
3815 length: 1
3816 };
3817 max_dims + 1
3818 ],
3819 vec![Datum::Int32(4)],
3820 );
3821 assert_eq!(res, Err(InvalidArrayError::TooManyDimensions(max_dims + 1)));
3822 assert!(row.data.is_empty());
3823
3824 // An array with exactly the maximum allowable dimensions should be
3825 // accepted.
3826 row.packer()
3827 .try_push_array(
3828 &vec![
3829 ArrayDimension {
3830 lower_bound: 1,
3831 length: 1
3832 };
3833 max_dims
3834 ],
3835 vec![Datum::Int32(4)],
3836 )
3837 .unwrap();
3838 }
3839
3840 #[mz_ore::test]
3841 fn test_array_wrong_cardinality() {

Callers

nothing calls this directly

Calls 3

try_push_arrayMethod · 0.80
packerMethod · 0.80
unwrapMethod · 0.80

Tested by

no test coverage detected