public void ConstructorTest() { var q = UnsafeMPMCQueue.Allocate <int>(10); Assert.AreEqual(0, UnsafeMPMCQueue.GetCount(q)); Assert.AreEqual(16, UnsafeMPMCQueue.GetCapacity(q)); UnsafeMPMCQueue.Free(q); }
public void ClearFixedTest() { int size = 128; // Power of two. var q = UnsafeMPMCQueue.Allocate <int>(size, true); //Inserts 10 items. SplitQueue(q); Assert.AreEqual(10, UnsafeMPMCQueue.GetCount(q)); Assert.AreEqual(size, UnsafeMPMCQueue.GetCapacity(q)); UnsafeMPMCQueue.Clear(q); Assert.AreEqual(0, UnsafeMPMCQueue.GetCount(q)); // Queue capacity needs to remain unchanged after clear. Assert.AreEqual(size, UnsafeMPMCQueue.GetCapacity(q)); Assert.IsTrue(UnsafeMPMCQueue.IsEmpty <int>(q)); UnsafeMPMCQueue.Free(q); }