()
| 525 | |
| 526 | #[test] |
| 527 | fn test_kg_neighbors() { |
| 528 | let dir = tempdir().unwrap(); |
| 529 | let pristine = Pristine::open(dir.path().join("db")).unwrap(); |
| 530 | let mut txn = pristine.write_txn().unwrap(); |
| 531 | txn.init_kg().unwrap(); |
| 532 | |
| 533 | txn.upsert_kg_node(&KgNode::new("a", "x", "A", "test")) |
| 534 | .unwrap(); |
| 535 | txn.upsert_kg_node(&KgNode::new("b", "x", "B", "test")) |
| 536 | .unwrap(); |
| 537 | txn.upsert_kg_node(&KgNode::new("c", "x", "C", "test")) |
| 538 | .unwrap(); |
| 539 | txn.upsert_kg_edge(&KgEdge::new("a", "b", "LINK")).unwrap(); |
| 540 | txn.upsert_kg_edge(&KgEdge::new("b", "c", "LINK")).unwrap(); |
| 541 | |
| 542 | // Depth 1 from "a" |
| 543 | let sg = txn.kg_neighbors("a", 1).unwrap(); |
| 544 | assert_eq!(sg.nodes.len(), 2); // a, b |
| 545 | assert_eq!(sg.edges.len(), 1); // a→b |
| 546 | |
| 547 | // Depth 2 from "a" |
| 548 | let sg = txn.kg_neighbors("a", 2).unwrap(); |
| 549 | assert_eq!(sg.nodes.len(), 3); // a, b, c |
| 550 | assert_eq!(sg.edges.len(), 2); // a→b, b→c |
| 551 | |
| 552 | txn.commit().unwrap(); |
| 553 | } |
| 554 | |
| 555 | #[test] |
| 556 | fn test_kg_fts_search() { |
nothing calls this directly
no test coverage detected