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

Function test_basic_match_operations

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

Source from the content-addressed store, hash-verified

12
13#[test]
14fn test_basic_match_operations() {
15 let fixture = TestFixture::new().expect("Failed to create test fixture");
16 // Setup fresh graph for this test to avoid interference
17 fixture
18 .setup_graph("test_basic_match_operations")
19 .expect("Failed to setup graph");
20 // Re-insert fraud data since we have a fresh graph
21 fixture
22 .insert_fraud_data()
23 .expect("Failed to insert fraud data");
24
25 // Test simple node matching
26 let result = fixture.assert_query_succeeds("MATCH (n) RETURN count(n) as total_nodes");
27 assert_eq!(result.rows.len(), 1);
28
29 // Test labeled node matching
30 fixture.assert_first_value(
31 "MATCH (a:Account) RETURN count(a) as account_count",
32 "account_count",
33 Value::Number(50.0),
34 );
35
36 fixture.assert_first_value(
37 "MATCH (m:Merchant) RETURN count(m) as merchant_count",
38 "merchant_count",
39 Value::Number(20.0),
40 );
41
42 // Test relationship matching
43 fixture.assert_first_value(
44 "MATCH ()-[r:Transaction]->() RETURN count(r) as transaction_count",
45 "transaction_count",
46 Value::Number(100.0), // Updated to match what fixture creates
47 );
48
49 fixture.assert_first_value(
50 "MATCH ()-[r:Purchase]->() RETURN count(r) as purchase_count",
51 "purchase_count",
52 Value::Number(50.0), // Updated to match what fixture creates
53 );
54
55 // Test pattern matching
56 fixture.assert_query_succeeds(
57 "MATCH (a:Account)-[t:Transaction]->(m:Merchant)
58 RETURN count(*) as pattern_count",
59 );
60
61 // Test bidirectional relationship matching
62 let result = fixture.assert_query_succeeds(
63 "MATCH (a:Account)-[r]-(m:Merchant)
64 RETURN count(r) as bidirectional_count",
65 );
66 assert!(!result.rows.is_empty());
67}
68
69#[test]
70fn test_where_clause_operations() {

Callers

nothing calls this directly

Calls 4

setup_graphMethod · 0.80
insert_fraud_dataMethod · 0.80
assert_first_valueMethod · 0.80
assert_query_succeedsMethod · 0.45

Tested by

no test coverage detected