コード例 #1
0
    public void TestIndexing3()
    {
        var a = new NativeArraySOA <T4>(150, Allocator.Temp);

        for (int i = a.Length - 1; i >= 0; --i)
        {
            a[i] = new T4
            {
                A = new T3
                {
                    A = i,
                    B = new T2 {
                        A = i * 13, B = 900 - i * 3
                    }
                },
                B = new T2 {
                    A = i * 33, B = 900 - i * 5
                },
            };
        }

        for (int i = 0; i < a.Length; ++i)
        {
            var e = a[i];
            Assert.AreEqual(i, e.A.A);
            Assert.AreEqual(i * 13, e.A.B.A);
            Assert.AreEqual(900 - i * 3, e.A.B.B);
            Assert.AreEqual(i * 33, e.B.A);
            Assert.AreEqual(900 - i * 5, e.B.B);
        }

        a.Dispose();
    }
コード例 #2
0
    public void TestIndexing1()
    {
        var a = new NativeArraySOA <T1>(150, Allocator.Temp);

        for (int i = 0; i < a.Length; ++i)
        {
            a[i] = new T1 {
                A = (uint)i
            };
        }

        for (int i = 0; i < a.Length; ++i)
        {
            var e = a[i];
            Assert.AreEqual(i, e.A);
        }

        a.Dispose();
    }
コード例 #3
0
    public void TestIndexing2()
    {
        var a = new NativeArraySOA <T2>(150, Allocator.Temp);

        for (int i = 0; i < a.Length; ++i)
        {
            a[i] = new T2 {
                A = i,
                B = 900 - i
            };
        }

        for (int i = 0; i < a.Length; ++i)
        {
            var e = a[i];
            Assert.AreEqual(i, e.A);
            Assert.AreEqual(900 - i, e.B);
        }

        a.Dispose();
    }