@@ -872,4 +872,30 @@ mod tests {
872872 calculate_random_times ( calculate_search_space ( 20 ) , 2048 , 30.0 ) ;
873873 assert_eq ! ( random_expected_20, 7680.0 ) ; // 2 hours 8 minutes in seconds
874874 }
875+
876+ #[ test]
877+ fn test_6bit_calculation_fix ( ) {
878+ // Test the specific 6-bit calculation issue identified in README.md
879+ // 6-bit systematic search (16 threads, 30s): ceil(32/16) * 30 = 2 * 30 = 60s = 1min 0s
880+
881+ let space_6bit = calculate_search_space ( 6 ) ; // 2^5 = 32
882+ assert_eq ! ( space_6bit, 32.0 ) ;
883+
884+ let ( _, systematic_worst_6) = calculate_systematic_times ( space_6bit, 16 , 30.0 ) ;
885+ assert_eq ! ( systematic_worst_6, 60.0 ) ; // Should be 60 seconds, not 31
886+ assert_eq ! ( pretty( systematic_worst_6) , "1min 0s" ) ; // Should format as 1min 0s
887+
888+ // Also verify bits 1-5 are correct at 30s each
889+ for bits in 1 ..=5 {
890+ let space = calculate_search_space ( bits) ;
891+ let ( _, worst) = calculate_systematic_times ( space, 16 , 30.0 ) ;
892+ assert_eq ! ( worst, 30.0 , "Bit {bits} should have 30s worst-case time" ) ;
893+ }
894+
895+ // And verify 7-bit is 2min 0s, not 2min 4s
896+ let space_7bit = calculate_search_space ( 7 ) ; // 2^6 = 64
897+ let ( _, systematic_worst_7) = calculate_systematic_times ( space_7bit, 16 , 30.0 ) ;
898+ assert_eq ! ( systematic_worst_7, 120.0 ) ; // Should be 120 seconds
899+ assert_eq ! ( pretty( systematic_worst_7) , "2min 0s" ) ; // Should format as 2min 0s
900+ }
875901}
0 commit comments