@@ -60,56 +60,58 @@ mod tests {
6060 use vortex_dtype:: DType ;
6161 use vortex_dtype:: Nullability ;
6262 use vortex_dtype:: PType ;
63+ use vortex_error:: VortexExpect ;
64+ use vortex_error:: VortexResult ;
6365
6466 use crate :: ALPVTable ;
6567
6668 #[ test]
67- fn test_cast_alp_f32_to_f64 ( ) {
69+ fn test_cast_alp_f32_to_f64 ( ) -> VortexResult < ( ) > {
6870 let values = buffer ! [ 1.5f32 , 2.5 , 3.5 , 4.5 ] . into_array ( ) ;
6971 let alp = ALPVTable
7072 . as_vtable ( )
71- . encode ( & values. to_canonical ( ) , None )
72- . unwrap ( )
73- . unwrap ( ) ;
73+ . encode ( & values. to_canonical ( ) ?, None ) ?
74+ . vortex_expect ( "must encode" ) ;
7475
7576 let casted = cast (
7677 alp. as_ref ( ) ,
7778 & DType :: Primitive ( PType :: F64 , Nullability :: NonNullable ) ,
78- )
79- . unwrap ( ) ;
79+ ) ?;
8080 assert_eq ! (
8181 casted. dtype( ) ,
8282 & DType :: Primitive ( PType :: F64 , Nullability :: NonNullable )
8383 ) ;
8484
85- let decoded = casted. to_canonical ( ) . into_primitive ( ) ;
85+ let decoded = casted. to_canonical ( ) ? . into_primitive ( ) ;
8686 let values = decoded. as_slice :: < f64 > ( ) ;
8787 assert_eq ! ( values. len( ) , 4 ) ;
8888 assert ! ( ( values[ 0 ] - 1.5 ) . abs( ) < f64 :: EPSILON ) ;
8989 assert ! ( ( values[ 1 ] - 2.5 ) . abs( ) < f64 :: EPSILON ) ;
90+
91+ Ok ( ( ) )
9092 }
9193
9294 #[ test]
93- fn test_cast_alp_to_int ( ) {
95+ fn test_cast_alp_to_int ( ) -> VortexResult < ( ) > {
9496 let values = buffer ! [ 1.0f32 , 2.0 , 3.0 , 4.0 ] . into_array ( ) ;
9597 let alp = ALPVTable
9698 . as_vtable ( )
97- . encode ( & values. to_canonical ( ) , None )
98- . unwrap ( )
99- . unwrap ( ) ;
99+ . encode ( & values. to_canonical ( ) ?, None ) ?
100+ . vortex_expect ( "must encode" ) ;
100101
101102 let casted = cast (
102103 alp. as_ref ( ) ,
103104 & DType :: Primitive ( PType :: I32 , Nullability :: NonNullable ) ,
104- )
105- . unwrap ( ) ;
105+ ) ?;
106106 assert_eq ! (
107107 casted. dtype( ) ,
108108 & DType :: Primitive ( PType :: I32 , Nullability :: NonNullable )
109109 ) ;
110110
111- let decoded = casted. to_canonical ( ) . into_primitive ( ) ;
111+ let decoded = casted. to_canonical ( ) ? . into_primitive ( ) ;
112112 assert_arrays_eq ! ( decoded, PrimitiveArray :: from_iter( [ 1i32 , 2 , 3 , 4 ] ) ) ;
113+
114+ Ok ( ( ) )
113115 }
114116
115117 #[ rstest]
@@ -118,12 +120,13 @@ mod tests {
118120 #[ case( PrimitiveArray :: from_option_iter( [ Some ( 1.1f32 ) , None , Some ( 2.2 ) , Some ( 3.3 ) , None ] ) . into_array( ) ) ]
119121 #[ case( buffer![ 42.42f64 ] . into_array( ) ) ]
120122 #[ case( buffer![ 0.0f32 , -1.5 , 2.5 , -3.5 , 4.5 ] . into_array( ) ) ]
121- fn test_cast_alp_conformance ( #[ case] array : vortex_array:: ArrayRef ) {
123+ fn test_cast_alp_conformance ( #[ case] array : vortex_array:: ArrayRef ) -> VortexResult < ( ) > {
122124 let alp = ALPVTable
123125 . as_vtable ( )
124- . encode ( & array. to_canonical ( ) , None )
125- . unwrap ( )
126- . unwrap ( ) ;
126+ . encode ( & array. to_canonical ( ) ?, None ) ?
127+ . vortex_expect ( "cannot fail" ) ;
127128 test_cast_conformance ( alp. as_ref ( ) ) ;
129+
130+ Ok ( ( ) )
128131 }
129132}
0 commit comments