public void ClearDictionary() { var map = UnsafeDictionary.Allocate <int, int>(16, fixedSize: false); for (int i = 0; i < 3; i++) { UnsafeDictionary.Add(map, i, 3); } Assert.IsTrue(UnsafeDictionary.ContainsKey(map, 2)); Assert.AreEqual(3, UnsafeDictionary.GetCount(map)); UnsafeDictionary.TryGetValue(map, 2, out int result); Assert.AreEqual(3, result); UnsafeDictionary.Add(map, 3, 1); Assert.AreEqual(4, UnsafeDictionary.GetCount(map)); UnsafeDictionary.Clear(map); Assert.AreEqual(0, UnsafeDictionary.GetCount(map)); Assert.IsFalse(UnsafeDictionary.ContainsKey(map, 2)); UnsafeDictionary.Add(map, 3, 10); Assert.AreEqual(1, UnsafeDictionary.GetCount(map)); Assert.IsTrue(UnsafeDictionary.ContainsKey(map, 3)); UnsafeDictionary.TryGetValue(map, 3, out int result2); Assert.AreEqual(10, result2); UnsafeDictionary.Clear(map); Assert.AreEqual(0, UnsafeDictionary.GetCount(map)); UnsafeDictionary.Free(map); }