Пример #1
0
    public void UnsafeHashSet_RemoveOnEmptyMap_DoesNotThrow()
    {
        var container = new UnsafeHashSet <int>(0, Allocator.Temp);

        Assert.DoesNotThrow(() => container.Remove(0));
        Assert.DoesNotThrow(() => container.Remove(-425196));
        container.Dispose();
    }
Пример #2
0
    public void UnsafeHashSet_IsEmpty()
    {
        var container = new UnsafeHashSet <int>(0, Allocator.Persistent);

        Assert.IsTrue(container.IsEmpty);

        Assert.IsTrue(container.Add(0));
        Assert.IsFalse(container.IsEmpty);
        Assert.AreEqual(1, container.Capacity);
        ExpectedCount(ref container, 1);

        container.Remove(0);
        Assert.IsTrue(container.IsEmpty);

        Assert.IsTrue(container.Add(0));
        container.Clear();
        Assert.IsTrue(container.IsEmpty);

        container.Dispose();
    }
Пример #3
0
        public void RemoveTest()
        {
            var set = UnsafeHashSet.Allocate <int>(10);

            Assert.IsFalse(UnsafeHashSet.Remove <int>(set, 1));

            UnsafeHashSet.Add(set, 1);
            UnsafeHashSet.Add(set, 7);
            UnsafeHashSet.Add(set, 51);
            UnsafeHashSet.Add(set, 13);

            Assert.IsFalse(UnsafeHashSet.Remove <int>(set, 3));

            Assert.IsTrue(UnsafeHashSet.Remove <int>(set, 1));
            Assert.IsTrue(UnsafeHashSet.Remove <int>(set, 7));
            Assert.IsTrue(UnsafeHashSet.Remove <int>(set, 13));
            Assert.IsTrue(UnsafeHashSet.Remove <int>(set, 51));

            Assert.IsFalse(UnsafeHashSet.Remove <int>(set, 13));

            UnsafeHashSet.Free(set);
        }
Пример #4
0
 public bool Remove(T item)
 {
     return(UnsafeHashSet.Remove <T>(m_inner, item));
 }