public void ConstructorTest() { var q = UnsafeSPSCQueue.Allocate <int>(10); Assert.AreEqual(0, UnsafeSPSCQueue.GetCount(q)); Assert.AreEqual(10, UnsafeSPSCQueue.GetCapacity(q)); UnsafeSPSCQueue.Free(q); }
public void EnqueueTest() { var q = UnsafeSPSCQueue.Allocate <int>(10); for (int i = 0; i < 10; i++) { UnsafeSPSCQueue.Enqueue(q, i * i); } Assert.AreEqual(10, UnsafeSPSCQueue.GetCount(q)); Assert.AreEqual(10, UnsafeSPSCQueue.GetCapacity(q)); UnsafeSPSCQueue.Clear(q); Assert.AreEqual(0, UnsafeSPSCQueue.GetCount(q)); Assert.AreEqual(10, UnsafeSPSCQueue.GetCapacity(q)); UnsafeSPSCQueue.Free(q); }