Esempio n. 1
0
    public void TestReplace()
    {
        var  b = new RenderingBlock();
        Int3 u = new Int3(1, 2, 3);

        b.Set(u, Matrix4x4.identity);
        b.Set(u, Matrix4x4.identity);
        b.Set(u, Matrix4x4.identity);
        Assert.AreEqual(1, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());
    }
Esempio n. 2
0
    public void TestRemoveInMiddle()
    {
        var  b = new RenderingBlock();
        Int3 u = new Int3(1, 2, 3);
        Int3 v = new Int3(4, 5, 6);
        Int3 w = new Int3(0, 0, 0);

        b.Set(u, Matrix4x4.identity);
        b.Set(v, Matrix4x4.identity);
        b.Set(w, Matrix4x4.identity);
        // u, v, w
        Assert.AreEqual(3, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());

        b.Clear(v);
        // u, w
        Assert.AreEqual(2, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());

        b.Set(v, Matrix4x4.identity);
        // u, w, v
        Assert.AreEqual(3, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());

        b.Clear(u);
        // w, v
        Assert.AreEqual(2, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());

        b.Set(u, Matrix4x4.identity);
        // w, v, u
        Assert.AreEqual(3, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());

        b.Clear(u);
        b.Clear(v);
        b.Clear(w);
        Assert.AreEqual(0, b.GetNumOccupied());
        Assert.IsTrue(b.CheckInvariants());
    }