MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_output_single_vertex

Function test_output_single_vertex

atomic-core/src/output/repo/content.rs:844–872  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

842
843 #[test]
844 fn test_output_single_vertex() {
845 let content = b"Hello, world!";
846 let node = make_vertex(1, 0, content.len() as u64);
847 let graph = make_simple_graph(node);
848 let order = make_simple_order();
849
850 let changes = MemoryChangeStore::new();
851 let change = make_change(content);
852 let hash = change.hash().unwrap();
853 changes.insert(hash, change);
854
855 let hash_fn = |id: NodeId| {
856 if id.get() == 1 {
857 Some(hash)
858 } else {
859 None
860 }
861 };
862
863 let mut buffer = Vec::new();
864 {
865 let pos = Position::ROOT;
866 let mut writer = ConflictWriter::new(&mut buffer, "test.rs", pos);
867
868 let result = output_graph_content(&changes, hash_fn, &graph, &order, &mut writer);
869 assert!(result.is_ok());
870 }
871 assert_eq!(&buffer, content);
872 }
873
874 #[test]
875 fn test_output_empty_vertex_skipped() {

Callers

nothing calls this directly

Calls 10

make_simple_graphFunction · 0.85
make_simple_orderFunction · 0.85
output_graph_contentFunction · 0.85
make_vertexFunction · 0.70
make_changeFunction · 0.70
getMethod · 0.65
lenMethod · 0.45
unwrapMethod · 0.45
hashMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected