|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- // using System.Threading.Tasks;
- // using NUnit.Framework;
- // using Svelto.Common;
- // using Svelto.ECS.DataStructures;
- //
- // namespace Svelto.ECS.Tests.Common.DataStructures
- // {
- // [TestFixture]
- // public class ThreadSafeNativeBagTest
- // {
- // [Test]
- // public void TestByteReallocWorks()
- // {
- // var threadNativeBag = new ThreadSafeNativeBag(Allocator.Persistent);
- //
- // Parallel.Invoke(() =>
- // {
- // for (int i = 0; i < 100; i++)
- // {
- // threadNativeBag.Enqueue((int)1);
- // }
- // }
- // , // close first Action
- // () =>
- // {
- // for (int i = 0; i < 100; i++)
- // {
- // threadNativeBag.Enqueue((int)2);
- // }
- // }
- // , //close second Action
- //
- // () =>
- // {
- // for (int i = 0; i < 100; i++)
- // {
- // threadNativeBag.Enqueue(3);
- // }
- // } //close third Action
- // ); //close parallel.invoke
- //
- // // for (int i = 0; i < 100; i++)
- // // {
- // // threadNativeBag.Enqueue(1);
- // // }
- //
- // int oneCount = 0, twoCount = 0, threeCount = 0;
- //
- // while (threadNativeBag.count > 0)
- // {
- // var value = threadNativeBag.Dequeue<int>();
- //
- // switch (value)
- // {
- // case 1:
- // oneCount++;
- // break;
- // case 2:
- // twoCount++;
- // break;
- // case 3:
- // threeCount++;
- // break;
- // }
- // }
- //
- // Assert.That(oneCount, Is.EqualTo(100));
- // Assert.That(twoCount, Is.EqualTo(100));
- // Assert.That(threeCount, Is.EqualTo(100));
- //
- // threadNativeBag.Dispose();
- // }
- // }
- // }
|