public static void RemoveBackup(bool encrypted, bool cache, Random?random = null) { (Core core, Dictionary <string, byte[]> verifyfilepaths, MetadataNode vfsroot, BPlusTree <byte[]> vfsdatastore)testdata; if (encrypted) { testdata = InitializeNewCoreWithStandardFiles(0, 1, cache: cache, random: random); } else { testdata = InitializeNewCoreWithStandardFiles(1, 0, cache: cache, random: random); } var(core, _, vfsroot, _) = testdata; var bh1 = core.RunBackup("test", "run1"); //System.Threading.Thread.Sleep(40); // Allow async writes to finish vfsroot.AddDirectory("src", VirtualFSInterop.MakeNewDirectoryMetadata("sub")); var bh2 = core.RunBackup("test", "run2"); //System.Threading.Thread.Sleep(40); // Allow async writes to finish // Full hash test core.RemoveBackup("test", HashTools.ByteArrayToHexViaLookup32(bh1.GetOrThrow())); //System.Threading.Thread.Sleep(40); // Allow async writes to finish // Just prefix core.RemoveBackup("test", HashTools.ByteArrayToHexViaLookup32(bh2.GetOrThrow()).Substring(0, 10)); // All backups deleted Assert.AreEqual(core.GetBackups("test").backups.Count(), 0); }
public void TestBytesSum() { string seq1 = "11111111"; string seq2 = "2222222F"; byte[] bin1 = HashTools.HexStringToByteArray(seq1); byte[] bin2 = HashTools.HexStringToByteArray(seq2); HashTools.BytesSum(bin1, bin2); Assert.IsTrue(HashTools.ByteArrayToHexViaLookup32(bin1) == "33333340"); }