()
| 10 | // Fuzzing test for protocol message parsing |
| 11 | #[tokio::test] |
| 12 | async fn test_fuzz_message_parsing() { |
| 13 | let test_cases = generate_fuzz_inputs(); |
| 14 | let mut successful_parses = 0; |
| 15 | let mut handled_errors = 0; |
| 16 | |
| 17 | for (i, input) in test_cases.iter().enumerate() { |
| 18 | match parse_message_safely(input).await { |
| 19 | Ok(_) => successful_parses += 1, |
| 20 | Err(_) => handled_errors += 1, |
| 21 | } |
| 22 | |
| 23 | // Log progress every 100 cases |
| 24 | if i % 100 == 0 { |
| 25 | println!("Processed {} fuzz cases: {} successful, {} errors", |
| 26 | i, successful_parses, handled_errors); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | println!("Fuzz testing complete: {}/{} cases handled safely", |
| 31 | successful_parses + handled_errors, test_cases.len()); |
| 32 | |
| 33 | // All cases should either parse successfully or error gracefully |
| 34 | assert_eq!(successful_parses + handled_errors, test_cases.len()); |
| 35 | } |
| 36 | |
| 37 | #[tokio::test] |
| 38 | async fn test_fuzz_startup_messages() { |
nothing calls this directly
no test coverage detected