()
| 377 | |
| 378 | #[test] |
| 379 | fn test_shortest_path_patterns() { |
| 380 | let fixture = TestFixture::with_fraud_data().expect("Failed to create test fixture"); |
| 381 | |
| 382 | // Create a more complex graph for shortest path testing |
| 383 | fixture.assert_query_succeeds( |
| 384 | "INSERT (a:PathNode {id: 'A'}), |
| 385 | (b:PathNode {id: 'B'}), |
| 386 | (c:PathNode {id: 'C'}), |
| 387 | (d:PathNode {id: 'D'}), |
| 388 | (e:PathNode {id: 'E'})", |
| 389 | ); |
| 390 | |
| 391 | // Create multiple paths between A and E |
| 392 | fixture.assert_query_succeeds( |
| 393 | "MATCH (a:PathNode {id: 'A'}), (b:PathNode {id: 'B'}), (c:PathNode {id: 'C'}), |
| 394 | (d:PathNode {id: 'D'}), (e:PathNode {id: 'E'}) |
| 395 | INSERT (a)-[:PATH {weight: 1}]->(b)-[:PATH {weight: 1}]->(e), |
| 396 | (a)-[:PATH {weight: 1}]->(c)-[:PATH {weight: 2}]->(d)-[:PATH {weight: 1}]->(e), |
| 397 | (a)-[:PATH {weight: 5}]->(e)", |
| 398 | ); |
| 399 | |
| 400 | // Test shortest path (if supported) |
| 401 | let result = fixture.query( |
| 402 | "MATCH path = shortestPath((a:PathNode {id: 'A'})-[:PATH*]-(e:PathNode {id: 'E'})) |
| 403 | RETURN length(path) as path_length", |
| 404 | ); |
| 405 | |
| 406 | match result { |
| 407 | Ok(r) => { |
| 408 | log::debug!("Shortest path supported: length = {:?}", r.rows); |
| 409 | assert!(!r.rows.is_empty()); |
| 410 | } |
| 411 | Err(_) => { |
| 412 | log::debug!("Shortest path syntax not supported, testing manual approach"); |
| 413 | |
| 414 | // Test manual shortest path using variable length with ORDER BY and LIMIT (demonstrating these work) |
| 415 | let result = fixture.assert_query_succeeds( |
| 416 | "MATCH (a:PathNode {id: 'A'})-[:PATH]{1,3}->(e:PathNode {id: 'E'}) |
| 417 | RETURN a.id as start_id, e.id as end_id |
| 418 | ORDER BY end_id DESC |
| 419 | LIMIT 1", |
| 420 | ); |
| 421 | assert!(!result.rows.is_empty()); |
| 422 | } |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | #[test] |
| 427 | fn test_pattern_performance() { |
nothing calls this directly
no test coverage detected