public NativeEntityComponentInitializer BuildEntity(EGID egid, int threadIndex)
        {
            NativeBag unsafeBuffer = _addOperationQueue.GetBuffer(threadIndex + 1);

            unsafeBuffer.Enqueue(_index);
            unsafeBuffer.Enqueue(new EGID(egid.entityID, egid.groupID));
            unsafeBuffer.ReserveEnqueue <uint>(out var index) = 0;

            return(new NativeEntityComponentInitializer(unsafeBuffer, index));
        }
        public NativeEntityComponentInitializer BuildEntity
            (uint eindex, ExclusiveGroupStruct buildGroup, int threadIndex)
        {
            NativeBag unsafeBuffer = _addOperationQueue.GetBuffer(threadIndex + 1);

            unsafeBuffer.Enqueue(_index);
            unsafeBuffer.Enqueue(new EGID(eindex, buildGroup));
            unsafeBuffer.ReserveEnqueue <uint>(out var index) = 0;

            return(new NativeEntityComponentInitializer(unsafeBuffer, index));
        }
예제 #3
0
        public NativeEntityInitializer BuildEntity(EGID egid, int threadIndex)
        {
            EntityReference reference = _entityLocator.ClaimReference();

            NativeBag unsafeBuffer = _addOperationQueue.GetBuffer(threadIndex + 1);

            unsafeBuffer.Enqueue(_index);
            unsafeBuffer.Enqueue(new EGID(egid.entityID, egid.groupID));
            unsafeBuffer.Enqueue(reference);
            unsafeBuffer.ReserveEnqueue <uint>(out var index) = 0;

            return(new NativeEntityInitializer(unsafeBuffer, index, reference));
        }
        public void TestReaderGreaterThanWriter()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                //write 16 uint. The writerHead will be at the end of the array
                for (var i = 0; i < 16; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(64));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120)); //

                //read 8 uint, the readerHead will be in the middle of the array
                for (var i = 0; i < 8; i++)
                {
                    Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(i));
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(32));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //write 4 uint, now the writer head wrapped and it's before the reader head
                //capacity must stay unchanged
                for (var i = 16; i < 16 + 7; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(60));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //now I will surpass reader, so it won't change the capacity because there is enough space
                for (var i = 16 + 7; i < 16 + 7 + 2; i++)
                {
                    _simpleNativeBag.Enqueue((uint)i);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(68));
                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(120));

                //dequeue everything and verify values
                int index = 8;
                while (_simpleNativeBag.IsEmpty())
                {
                    Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(index));
                    index++;
                }
            }
        }
        public void TestMixedReallocWorks()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 2; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((uint)0);
                    _simpleNativeBag.Enqueue((long)0);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(32));
            }
        }
        public void TestEnqueueTwiceDequeueOnceLeavesWithHalfOfTheEntities()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Dequeue <byte>();
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(208));
            }
        }
예제 #7
0
        public NativeEntityInitializer BuildEntity
            (uint eindex, ExclusiveBuildGroup exclusiveBuildGroup, int threadIndex)
        {
            EntityReference reference    = _entityLocator.ClaimReference();
            NativeBag       unsafeBuffer = _addOperationQueue.GetBuffer(threadIndex + 1);

            unsafeBuffer.Enqueue(_index); //each native ECS native operation is stored in an array, each request to perform a native operation in a queue. _index is the index of the operation in the array that will be dequeued later
            unsafeBuffer.Enqueue(new EGID(eindex, exclusiveBuildGroup));
            unsafeBuffer.Enqueue(reference);

            //NativeEntityInitializer is quite a complex beast. It holds the starting values of the component set by the user. These components must be later dequeued and in order to know how many components
            //must be dequeued, a count must be used. The space to hold the count is then reserved in the queue and index will be used access the count later on through NativeEntityInitializer so it can increment it.
            unsafeBuffer.ReserveEnqueue <uint>(out var index) = 0;

            return(new NativeEntityInitializer(unsafeBuffer, index, reference));
        }
        public void TestWhatYouEnqueueIsWhatIDequeueMixed()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);  //4
                    _simpleNativeBag.Enqueue(new Weird2()
                    {
                        a   = 0xFA
                        , b = 7
                    }); //(4 + 4) * 2 = 16
                    _simpleNativeBag.Enqueue(new Weird()
                    {
                        a   = 0xFA
                        , b = 7
                    });
                    _simpleNativeBag.Enqueue(new Weird2()
                    {
                        a   = 0xFA
                        , b = 7
                    });
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(0));
                    Assert.That(_simpleNativeBag.Dequeue <Weird2>(), Is.EqualTo(new Weird2()
                    {
                        a   = 0xFA
                        , b = 7
                    }));
                    Assert.That(_simpleNativeBag.Dequeue <Weird>(), Is.EqualTo(new Weird()
                    {
                        a   = 0xFA
                        , b = 7
                    }));
                    Assert.That(_simpleNativeBag.Dequeue <Weird2>(), Is.EqualTo(new Weird2()
                    {
                        a   = 0xFA
                        , b = 7
                    }));
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
        public void TestWhatYouEnqueueIsWhatIDequeue()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)1);
                    _simpleNativeBag.Enqueue((byte)2);
                    _simpleNativeBag.Enqueue((byte)3);
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(0));
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(1));
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(2));
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(3));
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
예제 #10
0
        public void TestEnqueueDequeueWontAllocTooMuchWithWeirdStruct()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue(new Weird()); //8
                    _simpleNativeBag.Enqueue(new Weird()); //OK
                    _simpleNativeBag.Enqueue(new Weird()); //24
                    _simpleNativeBag.Enqueue(new Weird()); //ok
                    _simpleNativeBag.Dequeue <Weird>();
                    _simpleNativeBag.Dequeue <Weird>();
                    _simpleNativeBag.Dequeue <Weird>();
                    _simpleNativeBag.Dequeue <Weird>();
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
예제 #11
0
        public void TestEnqueueDequeueWontAllocTooMuch()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
예제 #12
0
        public void TestCantDequeMoreThanQueue()
        {
            Assert.Throws <Exception>(() =>
            {
                using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    _simpleNativeBag.Enqueue((byte)0);

                    for (var i = 0; i < 3; i++)
                    {
                        _simpleNativeBag.Enqueue((byte)0);
                        _simpleNativeBag.Dequeue <byte>();
                        _simpleNativeBag.Dequeue <byte>();
                    }

                    Assert.That(_simpleNativeBag.count, Is.EqualTo(32));
                }
            });
        }
예제 #13
0
        public void TestEnqueueDequeueWontAllocTooMuchWithWeirdStructUnalignedOnce()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                {
                    _simpleNativeBag.Enqueue(new Weird2()); //8
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(8));
                    _simpleNativeBag.Enqueue(new Weird2()); //OK
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(8));
                    _simpleNativeBag.Enqueue(new Weird2()); //24
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
                    _simpleNativeBag.Enqueue(new Weird2()); //ok
                    _simpleNativeBag.Dequeue <Weird2>();
                    _simpleNativeBag.Dequeue <Weird2>();
                    _simpleNativeBag.Dequeue <Weird2>();
                    _simpleNativeBag.Dequeue <Weird2>();
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
예제 #14
0
        public void TestByteReallocWorks()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)0);
                }

                Assert.That(_simpleNativeBag.count, Is.EqualTo(128));
            }
        }
예제 #15
0
        public void TestEnqueueDequeueWontAllocTooMuchOnce()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                {
                    _simpleNativeBag.Enqueue((byte)0);
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(8));
                    _simpleNativeBag.Enqueue((byte)0);
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(8));
                    _simpleNativeBag.Enqueue((byte)0);
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24)); //(8 + 1) * 2 = 18 => aligned 24
                    _simpleNativeBag.Enqueue((byte)0);
                    Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                    _simpleNativeBag.Dequeue <byte>();
                }

                Assert.That(_simpleNativeBag.capacity, Is.EqualTo(24));
            }
        }
예제 #16
0
        public void TestDoofusesScenarioByte()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                for (var i = 0; i < 32; i++)
                {
                    _simpleNativeBag.Enqueue((byte)i);
                    _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct()));
                }

                var index = 0;

                while (_simpleNativeBag.IsEmpty() == false)
                {
                    Assert.That(_simpleNativeBag.Dequeue <byte>(), Is.EqualTo(index));
                    var dequeue = _simpleNativeBag.Dequeue <EGID>();
                    index++;
                    Assert.That(_simpleNativeBag.count == 32 * 12 - index * 12);
                    Assert.That(dequeue.entityID, Is.EqualTo(1));
                    Assert.That((uint)dequeue.groupID, Is.EqualTo(0));
                }
            }
        }
예제 #17
0
        public void TestDoofusesScenario5()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(1)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                var dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(1));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(2)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(3)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(4)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(5)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(2));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(3));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(4));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(5));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(6)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(7)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(8)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(9)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(6));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(7));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(8));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(9));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(10)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(10));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(11)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(12)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(11));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(12));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(13)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(14)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(15)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(16)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(17)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGID(1, new ExclusiveGroupStruct(18)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(13));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(14));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(15));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(16));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(17));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGID>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(18));
            }
        }
예제 #18
0
        public void TestDoofusesScenario4Unaligned()
        {
            using (var _simpleNativeBag = new NativeBag(Allocator.Persistent))
            {
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(1)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(2)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(3)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                var dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(1));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(2));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(3));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(1)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(2)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(3)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(1));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(2));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(3));

                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(1)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(2)));
                _simpleNativeBag.Enqueue((uint)1);
                _simpleNativeBag.Enqueue(new EGIDU(1, new ExclusiveGroupStructU(3)));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(1));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(2));

                Assert.That(_simpleNativeBag.Dequeue <uint>(), Is.EqualTo(1));
                dequeue = _simpleNativeBag.Dequeue <EGIDU>();
                Assert.That(dequeue.entityID, Is.EqualTo(1));
                Assert.That((uint)dequeue.groupID, Is.EqualTo(3));
            }
        }