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

Function test_pattern_data_driven_cases

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

Source from the content-addressed store, hash-verified

306
307#[test]
308fn test_pattern_data_driven_cases() {
309 let test_suite = TestSuite {
310 name: "Pattern Matching Test Suite".to_string(),
311 fixture_type: FixtureType::Fraud,
312 test_cases: vec![
313 // Basic pattern tests
314 TestCase {
315 name: "simple_node_pattern".to_string(),
316 description: "Match simple node pattern".to_string(),
317 query: "MATCH (n) RETURN count(n) as total_nodes".to_string(),
318 expected_rows: Some(1),
319 expected_values: Some(HashMap::from([("total_nodes".to_string(), Value::Number(70.0))])),
320 expected_error: None,
321 },
322 TestCase {
323 name: "labeled_node_pattern".to_string(),
324 description: "Match labeled node pattern".to_string(),
325 query: "MATCH (a:Account) RETURN count(a) as accounts".to_string(),
326 expected_rows: Some(1),
327 expected_values: Some(HashMap::from([("accounts".to_string(), Value::Number(50.0))])),
328 expected_error: None,
329 },
330 TestCase {
331 name: "relationship_pattern".to_string(),
332 description: "Match relationship pattern".to_string(),
333 query: "MATCH ()-[r:Transaction]->() RETURN count(r) as transactions".to_string(),
334 expected_rows: Some(1),
335 expected_values: Some(HashMap::from([("transactions".to_string(), Value::Number(100.0))])),
336 expected_error: None,
337 },
338 // Complex pattern tests
339 TestCase {
340 name: "multi_hop_pattern".to_string(),
341 description: "Match multi-hop pattern".to_string(),
342 query: "MATCH (a1:Account)-[:Transaction]->(m:Merchant)<-[:Transaction]-(a2:Account) WHERE a1 <> a2 RETURN count(*) as shared_merchants".to_string(),
343 expected_rows: Some(1),
344 expected_values: None,
345 expected_error: None,
346 },
347 TestCase {
348 name: "optional_pattern".to_string(),
349 description: "Match with optional pattern".to_string(),
350 query: "MATCH (a:Account) RETURN count(DISTINCT a) as all_accounts".to_string(),
351 expected_rows: Some(1),
352 expected_values: Some(HashMap::from([("all_accounts".to_string(), Value::Number(50.0))])),
353 expected_error: None,
354 },
355 // Variable length patterns
356 TestCase {
357 name: "variable_length_pattern".to_string(),
358 description: "Match variable length pattern".to_string(),
359 query: "MATCH path = ()-[:Transaction|Purchase]->{1,2}() RETURN count(path) as paths LIMIT 1000".to_string(),
360 expected_rows: Some(1),
361 expected_values: None,
362 expected_error: None,
363 },
364 ],
365 };

Callers

nothing calls this directly

Calls 2

runMethod · 0.80
print_summaryMethod · 0.80

Tested by

no test coverage detected