MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_fuzz_message_parsing

Function test_fuzz_message_parsing

tests/protocol_fuzzing_test.rs:12–35  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10// Fuzzing test for protocol message parsing
11#[tokio::test]
12async 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]
38async fn test_fuzz_startup_messages() {

Callers

nothing calls this directly

Calls 2

generate_fuzz_inputsFunction · 0.85
parse_message_safelyFunction · 0.85

Tested by

no test coverage detected