()
| 1065 | |
| 1066 | #[test] |
| 1067 | fn test_binary_content() { |
| 1068 | let store = MemoryChangeStore::new(); |
| 1069 | let content: Vec<u8> = (0..=255).collect(); |
| 1070 | let change = create_test_change("Binary", &content); |
| 1071 | let hash = change.hash().unwrap(); |
| 1072 | store.insert(hash, change); |
| 1073 | |
| 1074 | let node_id = NodeId::new(1); |
| 1075 | let hash_fn = move |id: NodeId| { |
| 1076 | if id == node_id { |
| 1077 | Some(hash) |
| 1078 | } else { |
| 1079 | None |
| 1080 | } |
| 1081 | }; |
| 1082 | |
| 1083 | let node = GraphNode::new( |
| 1084 | node_id, |
| 1085 | ChangePosition::new(0), |
| 1086 | ChangePosition::new(content.len() as u64), |
| 1087 | ); |
| 1088 | let mut buf = vec![0u8; content.len()]; |
| 1089 | |
| 1090 | let n = store.get_contents(hash_fn, node, &mut buf).unwrap(); |
| 1091 | assert_eq!(n, content.len()); |
| 1092 | assert_eq!(buf, content); |
| 1093 | } |
| 1094 | |
| 1095 | #[test] |
| 1096 | fn test_multiple_changes() { |
nothing calls this directly
no test coverage detected