Esempio n. 1
0
        public void RunSimpleJob()
        {
            didDispose = 0;
            SimpleJob job = new SimpleJob()
            {
                a = 5,
                b = 10
            };

            NativeArray <int> jobResult = new NativeArray <int>(SimpleJob.N, Allocator.TempJob);

            job.result = jobResult;

            job.Run();

#if !UNITY_DOTSPLAYER
            // TODO: Understand / fix why the editor tests don't run quite the same code path.
            job.mDisposable.Dispose();
#endif

            Assert.AreEqual(1, didDispose);
            for (int i = 0; i < SimpleJob.N; ++i)
            {
                Assert.AreEqual(15, jobResult[i]);
            }
            jobResult.Dispose();
        }
Esempio n. 2
0
        public void RunSimpleJob()
        {
            didDispose = 0;
            SimpleJob job = new SimpleJob()
            {
                a = 5,
                b = 10
            };

            NativeArray <int> jobResult = new NativeArray <int>(SimpleJob.N, Allocator.TempJob);

            job.result = jobResult;

            job.Run();

#if NET_DOTS
            // TODO: didDispose does not get called for reflection (big-ECS), but does for code-gen (Tiny-ECS)
            // The code-gen is finding the DoDeallocateOnJobCompletion at compile time, and my be using
            // a slightly different rule set for finding the attribute.
            Assert.AreEqual(1, didDispose);
#endif

            for (int i = 0; i < SimpleJob.N; ++i)
            {
                Assert.AreEqual(15, jobResult[i]);
            }

            jobResult.Dispose();
        }
Esempio n. 3
0
        public void RunSimpleJob()
        {
            SimpleJob job = new SimpleJob()
            {
                a = 5,
                b = 10
            };
            NativeArray <int> jobResult = new NativeArray <int>(SimpleJob.N, Allocator.TempJob);

            job.result = jobResult;

            job.Run();

            for (int i = 0; i < SimpleJob.N; ++i)
            {
                Assert.AreEqual(15, jobResult[i]);
            }

            jobResult.Dispose();
        }