@@ -21,21 +21,30 @@ fn test_config_invalid_ola() {
2121 assert ! ( config. is_err( ) )
2222}
2323
24+ #[ cfg( not( feature = "rustfft-backend" ) ) ]
2425#[ test]
2526#[ allow( deprecated) ]
2627fn test_config_invalid_fft_size ( ) {
2728 let config = StftConfig :: < f32 > :: new ( 4095 , 1024 , WindowType :: Hann , ReconstructionMode :: Ola ) ;
28- assert ! ( matches!( config, Err ( _) ) ) ;
29+ assert ! ( config. is_err( ) ) ;
30+ }
31+
32+ #[ cfg( feature = "rustfft-backend" ) ]
33+ #[ test]
34+ #[ allow( deprecated) ]
35+ fn test_config_fft_size_not_power_of_two ( ) {
36+ let config = StftConfig :: < f32 > :: new ( 4095 , 1024 , WindowType :: Hann , ReconstructionMode :: Ola ) ;
37+ assert ! ( config. is_ok( ) ) ;
2938}
3039
3140#[ test]
3241#[ allow( deprecated) ]
3342fn test_config_invalid_hop_size ( ) {
3443 let config = StftConfig :: < f32 > :: new ( 4096 , 0 , WindowType :: Hann , ReconstructionMode :: Ola ) ;
35- assert ! ( matches! ( config, Err ( _ ) ) ) ;
44+ assert ! ( config. is_err ( ) ) ;
3645
3746 let config = StftConfig :: < f32 > :: new ( 4096 , 5000 , WindowType :: Hann , ReconstructionMode :: Ola ) ;
38- assert ! ( matches! ( config, Err ( _ ) ) ) ;
47+ assert ! ( config. is_err ( ) ) ;
3948}
4049
4150// Builder pattern tests
@@ -75,20 +84,17 @@ fn test_builder_with_reconstruction_mode() {
7584
7685#[ test]
7786fn test_builder_missing_fft_size ( ) {
78- let config = StftConfig :: < f32 > :: builder ( )
79- . hop_size ( 1024 )
80- . build ( ) ;
87+ let config = StftConfig :: < f32 > :: builder ( ) . hop_size ( 1024 ) . build ( ) ;
8188 assert ! ( config. is_err( ) ) ;
8289}
8390
8491#[ test]
8592fn test_builder_missing_hop_size ( ) {
86- let config = StftConfig :: < f32 > :: builder ( )
87- . fft_size ( 4096 )
88- . build ( ) ;
93+ let config = StftConfig :: < f32 > :: builder ( ) . fft_size ( 4096 ) . build ( ) ;
8994 assert ! ( config. is_err( ) ) ;
9095}
9196
97+ #[ cfg( not( feature = "rustfft-backend" ) ) ]
9298#[ test]
9399fn test_builder_invalid_fft_size ( ) {
94100 let config = StftConfig :: < f32 > :: builder ( )
@@ -98,6 +104,16 @@ fn test_builder_invalid_fft_size() {
98104 assert ! ( config. is_err( ) ) ;
99105}
100106
107+ #[ cfg( feature = "rustfft-backend" ) ]
108+ #[ test]
109+ fn test_builder_fft_size_not_power_of_two ( ) {
110+ let config = StftConfig :: < f32 > :: builder ( )
111+ . fft_size ( 4095 ) // Not a power of 2
112+ . hop_size ( 1024 )
113+ . build ( ) ;
114+ assert ! ( config. is_ok( ) ) ;
115+ }
116+
101117#[ test]
102118fn test_builder_invalid_hop_size ( ) {
103119 let config = StftConfig :: < f32 > :: builder ( )
0 commit comments