(write_all: bool)
| 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() { |
no test coverage detected