()
| 841 | |
| 842 | #[test] |
| 843 | fn test_get_contents_partial() { |
| 844 | let store = MemoryChangeStore::new(); |
| 845 | let content = b"0123456789"; |
| 846 | let change = create_test_change("Partial", content); |
| 847 | let hash = change.hash().unwrap(); |
| 848 | store.insert(hash, change); |
| 849 | |
| 850 | let node_id = NodeId::new(1); |
| 851 | let hash_fn = move |id: NodeId| { |
| 852 | if id == node_id { |
| 853 | Some(hash) |
| 854 | } else { |
| 855 | None |
| 856 | } |
| 857 | }; |
| 858 | |
| 859 | // Read middle portion |
| 860 | let node = GraphNode::new(node_id, ChangePosition::new(3), ChangePosition::new(7)); |
| 861 | let mut buf = vec![0u8; 4]; |
| 862 | |
| 863 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 864 | |
| 865 | assert_eq!(n, 4); |
| 866 | assert_eq!(&buf, b"3456"); |
| 867 | } |
| 868 | |
| 869 | #[test] |
| 870 | fn test_get_contents_empty_vertex() { |
nothing calls this directly
no test coverage detected