()
| 1089 | |
| 1090 | #[test] |
| 1091 | fn test_binary_content() { |
| 1092 | let store = MemoryChangeStore::new(); |
| 1093 | let content: Vec<u8> = (0..=255).collect(); |
| 1094 | let change = create_test_change("Binary", &content); |
| 1095 | let hash = change.hash().unwrap(); |
| 1096 | store.insert(hash, change); |
| 1097 | |
| 1098 | let node_id = NodeId::new(1); |
| 1099 | let hash_fn = move |id: NodeId| { |
| 1100 | if id == node_id { |
| 1101 | Some(hash) |
| 1102 | } else { |
| 1103 | None |
| 1104 | } |
| 1105 | }; |
| 1106 | |
| 1107 | let node = GraphNode::new( |
| 1108 | node_id, |
| 1109 | ChangePosition::new(0), |
| 1110 | ChangePosition::new(content.len() as u64), |
| 1111 | ); |
| 1112 | let mut buf = vec![0u8; content.len()]; |
| 1113 | |
| 1114 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1115 | assert_eq!(n, content.len()); |
| 1116 | assert_eq!(buf, content); |
| 1117 | } |
| 1118 | |
| 1119 | #[test] |
| 1120 | fn test_multiple_changes() { |
nothing calls this directly
no test coverage detected