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

Function test_complex_path_patterns

graphlite/tests/pattern_tests.rs:131–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129
130#[test]
131fn test_complex_path_patterns() {
132 let fixture = TestFixture::with_fraud_data().expect("Failed to create test fixture");
133
134 // Test simple path pattern
135 let result = fixture.assert_query_succeeds(
136 "MATCH path = (a:Account)-[t:Transaction]->(m:Merchant)
137 RETURN count(path) as transaction_paths",
138 );
139 assert!(!result.rows.is_empty());
140
141 // Test multi-hop path pattern
142 let result = fixture.assert_query_succeeds(
143 "MATCH path = (a1:Account)-[t1:Transaction]->(m:Merchant)<-[t2:Transaction]-(a2:Account)
144 WHERE a1 <> a2
145 RETURN count(path) as shared_merchant_paths",
146 );
147 assert!(!result.rows.is_empty());
148
149 // Test path with multiple relationship types
150 let result = fixture.assert_query_succeeds(
151 "MATCH path = (a:Account)-[r:Transaction|Purchase]->(m:Merchant)
152 RETURN count(path) as mixed_relationship_paths",
153 );
154 assert!(!result.rows.is_empty());
155
156 // Test triangular patterns
157 fixture.assert_query_succeeds(
158 "INSERT (hub:Hub {id: 'central'}),
159 (node1:TestNode {id: 1}),
160 (node2:TestNode {id: 2})",
161 );
162
163 fixture.assert_query_succeeds(
164 "MATCH (hub:Hub), (n1:TestNode {id: 1}), (n2:TestNode {id: 2})
165 INSERT (hub)-[:CONNECTS]->(n1),
166 (hub)-[:CONNECTS]->(n2),
167 (n1)-[:LINKS]->(n2)",
168 );
169
170 let result = fixture.assert_query_succeeds(
171 "MATCH triangle = (hub:Hub)-[:CONNECTS]->(n1:TestNode)-[:LINKS]->(n2:TestNode)<-[:CONNECTS]-(hub)
172 RETURN count(triangle) as triangles"
173 );
174 assert!(!result.rows.is_empty());
175}
176
177#[test]
178fn test_variable_length_patterns() {

Callers

nothing calls this directly

Calls 1

assert_query_succeedsMethod · 0.45

Tested by

no test coverage detected