MCPcopy Create free account
hub / github.com/git/git / test_map

Function test_map

src/loose.rs:720–739  ·  view source on GitHub ↗
(write_all: bool)

Source from the content-addressed store, hash-verified

718 }
719
720 fn test_map(write_all: bool) -> Box<ObjectMap> {
721 let mut map = Box::new(ObjectMap::new(HashAlgorithm::SHA256, HashAlgorithm::SHA1));
722
723 map.start_batch();
724
725 for (_blob_content, sha1, sha256, kind, swap) in test_entries() {
726 let s256 = sha256_oid(sha256);
727 let s1 = sha1_oid(sha1);
728 let write = write_all || (*kind as u32 & 2) == 0;
729 if *swap {
730 // Insert the item into the batch arbitrarily based on the type. This tests that
731 // we can specify either order and we'll do the right thing.
732 map.insert(&s256, &s1, *kind, write);
733 } else {
734 map.insert(&s1, &s256, *kind, write);
735 }
736 }
737
738 map
739 }
740
741 #[test]
742 fn can_read_and_write_format() {

Callers 4

looks_up_from_mmapedFunction · 0.85
looks_up_oid_correctlyFunction · 0.85

Calls 5

test_entriesFunction · 0.85
sha256_oidFunction · 0.85
sha1_oidFunction · 0.85
start_batchMethod · 0.80
insertMethod · 0.80

Tested by

no test coverage detected