MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / test_complex_query_patterns

Function test_complex_query_patterns

graphlite/tests/dql_tests.rs:440–505  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

438
439#[test]
440fn test_complex_query_patterns() {
441 let fixture = TestFixture::new().expect("Failed to create test fixture");
442 // Setup fresh graph for this test to avoid interference
443 fixture
444 .setup_graph("test_complex_query_patterns")
445 .expect("Failed to setup graph");
446 // Re-insert fraud data since we have a fresh graph
447 fixture
448 .insert_fraud_data()
449 .expect("Failed to insert fraud data");
450
451 // Test simple multi-pattern matching
452 let result = fixture.assert_query_succeeds(
453 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
454 WHERE t.amount > 50
455 RETURN a.id, m.name, t.amount
456 LIMIT 10",
457 );
458 assert!(result.rows.len() <= 10);
459
460 // Test pattern with aggregation
461 let result = fixture.assert_query_succeeds(
462 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
463 WHERE t.amount > 100
464 RETURN a.id, count(t) as transaction_count
465 GROUP BY a.id
466 LIMIT 20",
467 );
468 assert!(result.rows.len() <= 20);
469
470 // Test multiple relationship types
471 let result = fixture.assert_query_succeeds(
472 "MATCH (a:Account)-[r]->(m:Merchant)
473 WHERE a.balance > 2000
474 RETURN a.id, count(r) as total_relationships
475 GROUP BY a.id
476 LIMIT 15",
477 );
478 assert!(result.rows.len() <= 15);
479
480 // Test basic WHERE filtering
481 let result = fixture.assert_query_succeeds(
482 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
483 WHERE t.amount > 100
484 RETURN a.id, a.balance, t.amount
485 LIMIT 10",
486 );
487 assert!(result.rows.len() <= 10);
488
489 // Test high value queries
490 let result = fixture.assert_query_succeeds(
491 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
492 WHERE t.amount > 200
493 RETURN a.id, t.amount
494 LIMIT 10",
495 );
496 assert!(result.rows.len() <= 10);
497

Callers

nothing calls this directly

Calls 3

setup_graphMethod · 0.80
insert_fraud_dataMethod · 0.80
assert_query_succeedsMethod · 0.45

Tested by

no test coverage detected