static UnsafeHashSet *Set(params int[] values) { var c = UnsafeHashSet.Allocate <int>(values.Length * 2); for (int i = 0; i < values.Length; ++i) { UnsafeHashSet.Add(c, values[i]); } return(c); }
public void ClearHashSet() { var set = Set(1, 2, 3); IsTrue(UnsafeHashSet.Contains(set, 2)); IsTrue(UnsafeHashSet.Count(set) == 3); UnsafeHashSet.Add(set, 4); IsTrue(UnsafeHashSet.Count(set) == 4); UnsafeHashSet.Clear(set); IsTrue(UnsafeHashSet.Count(set) == 0); IsTrue(!UnsafeHashSet.Contains(set, 2)); UnsafeHashSet.Add(set, 4); IsTrue(UnsafeHashSet.Count(set) == 1); IsTrue(UnsafeHashSet.Contains(set, 4)); UnsafeHashSet.Clear(set); IsTrue(UnsafeHashSet.Count(set) == 0); }