Exemplo n.º 1
0
        public void QuiverGeneration_WithStartGenerationFromBase_GeneratesOddFlower5FromCobweb5Correctly()
        {
            var quiverInPlane = UsefulQuiversInPlane.GetCobwebQuiverInPlane(5, 50, firstVertex: 1);
            var qp            = UsefulQPs.GetCobwebQP(5, firstVertex: 1);
            var potential     = qp.Potential;
            var boundaryLayer = UsefulQPs.GetVerticesInCobwebQPLayer(5, 1, firstVertex: 1);
            var layerType     = CreateLayerType(10, 5, 20); // 5 arrow pairs, all implicit

            generator.StartGenerationFromBase(quiverInPlane, potential, boundaryLayer, layerType, nextVertex: qp.Quiver.Vertices.Count + 1);
            generator.SupplyComposition(CreateComposition(Utility.RepeatMany(5, 1, 1))); // No choice for the 5 arrow pairs
            generator.SupplyComposition(CreateComposition(Utility.RepeatMany(5, 3, 3))); // 2 steps left and right (both of which can be 0)

            var output = generator.EndGeneration();

            qp        = output.QP;
            potential = qp.Potential;
            var expectedPotential = CreatePotential(new Dictionary <DetachedCycle <int>, int>
            {
                { CreateDetachedCycle(1, 2, 3, 4, 5, 1), +1 },

                { CreateDetachedCycle(1, 2, 7, 6, 1), -1 },
                { CreateDetachedCycle(2, 3, 9, 8, 2), -1 },
                { CreateDetachedCycle(3, 4, 11, 10, 3), -1 },
                { CreateDetachedCycle(4, 5, 13, 12, 4), -1 },
                { CreateDetachedCycle(5, 1, 15, 14, 5), -1 },

                { CreateDetachedCycle(1, 15, 6, 1), +1 },
                { CreateDetachedCycle(2, 7, 8, 2), +1 },
                { CreateDetachedCycle(3, 9, 10, 3), +1 },
                { CreateDetachedCycle(4, 11, 12, 4), +1 },
                { CreateDetachedCycle(5, 13, 14, 5), +1 },

                { CreateDetachedCycle(6, 18, 17, 16, 15, 6), -1 },
                { CreateDetachedCycle(8, 22, 21, 20, 7, 8), -1 },
                { CreateDetachedCycle(10, 26, 25, 24, 9, 10), -1 },
                { CreateDetachedCycle(12, 30, 29, 28, 11, 12), -1 },
                { CreateDetachedCycle(14, 34, 33, 32, 13, 14), -1 },

                { CreateDetachedCycle(6, 18, 19, 20, 7, 6), +1 },
                { CreateDetachedCycle(8, 22, 23, 24, 9, 8), +1 },
                { CreateDetachedCycle(10, 26, 27, 28, 11, 10), +1 },
                { CreateDetachedCycle(12, 30, 31, 32, 13, 12), +1 },
                { CreateDetachedCycle(14, 34, 35, 16, 15, 14), +1 },
            });

            Assert.That(potential, Is.EqualTo(expectedPotential));
        }
Exemplo n.º 2
0
        public void GetVerticesInCobwebQPLayer_Works(int numVerticesInCenterPolygon, int layerIndex, int firstVertex, params int[] expectedVertices)
        {
            var actualVertices = UsefulQPs.GetVerticesInCobwebQPLayer(numVerticesInCenterPolygon, layerIndex, firstVertex);

            Assert.That(actualVertices, Is.EqualTo(expectedVertices));
        }
Exemplo n.º 3
0
        public void GetVerticesInCobwebQPLayer_ThrowsOnBadLayerIndex(int layerIndex)
        {
            int numVerticesInCenterPolygon = 5;

            Assert.That(() => UsefulQPs.GetVerticesInCobwebQPLayer(numVerticesInCenterPolygon, layerIndex), Throws.InstanceOf <ArgumentOutOfRangeException>());
        }