public void Capacity_grwoth_and_shrinkage() { StateDb db = new StateDb(new MemDb()); for (int i = 0; i < 16; i++) { _hash1 = Keccak.Compute(_hash1.Bytes); db.Set(_hash1, _bytes1); } db.Restore(-1); byte[] getResult = db.Get(_hash1); Assert.AreEqual(null, getResult); for (int i = 0; i < 16; i++) { _hash1 = Keccak.Compute(_hash1.Bytes); db.Set(_hash1, _bytes1); } db.Commit(); getResult = db.Get(_hash1); Assert.AreEqual(_bytes1, getResult); }
public void Set_restore_get() { StateDb db = new StateDb(new MemDb()); db.Set(_hash1, _bytes1); db.Restore(-1); byte[] getResult = db.Get(_hash1); Assert.AreEqual(null, getResult); }
public void Restore_in_the_middle() { StateDb db = new StateDb(new MemDb()); db.Set(_hash1, _bytes1); int snapshot = db.TakeSnapshot(); db.Set(_hash2, _bytes2); db.Restore(snapshot); byte[] getResult = db.Get(_hash2); Assert.IsNull(getResult); }