()
| 817 | |
| 818 | #[test] |
| 819 | fn test_get_contents_partial() { |
| 820 | let store = MemoryChangeStore::new(); |
| 821 | let content = b"0123456789"; |
| 822 | let change = create_test_change("Partial", content); |
| 823 | let hash = change.hash().unwrap(); |
| 824 | store.insert(hash, change); |
| 825 | |
| 826 | let node_id = NodeId::new(1); |
| 827 | let hash_fn = move |id: NodeId| { |
| 828 | if id == node_id { |
| 829 | Some(hash) |
| 830 | } else { |
| 831 | None |
| 832 | } |
| 833 | }; |
| 834 | |
| 835 | // Read middle portion |
| 836 | let node = GraphNode::new(node_id, ChangePosition::new(3), ChangePosition::new(7)); |
| 837 | let mut buf = vec![0u8; 4]; |
| 838 | |
| 839 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 840 | |
| 841 | assert_eq!(n, 4); |
| 842 | assert_eq!(&buf, b"3456"); |
| 843 | } |
| 844 | |
| 845 | #[test] |
| 846 | fn test_get_contents_empty_vertex() { |
nothing calls this directly
no test coverage detected