public void TwoHorizontalTest() { IList <Edge> edges = new[] { E(0, 0, 1, 0), E(1, 0, 2, 0), }; edges = TriggerZoneBuilder.MergeEdges(edges); Assert.Collection(edges, e => Assert.Equal(E(0, 0, 2, 0), e)); edges = new[] { E(1, 0, 2, 0), E(1, 0, 0, 0), }; edges = TriggerZoneBuilder.MergeEdges(edges); Assert.Collection(edges, e => Assert.Equal(E(0, 0, 2, 0), e)); edges = new[] { E(0, 0, 1, 0), E(2, 0, 3, 0), }; edges = TriggerZoneBuilder.MergeEdges(edges); Assert.Collection(edges, e => Assert.Equal(E(0, 0, 1, 0), e), e => Assert.Equal(E(2, 0, 3, 0), e) ); }
public void TwoVerticalTest() { IList <Edge> edges = new[] { E(0, 0, 0, 1), E(0, 1, 0, 2), }; edges = TriggerZoneBuilder.MergeEdges(edges); Assert.Collection(edges, e => Assert.Equal(E(0, 0, 0, 2), e) ); }
public void BoxTest() { IList <Edge> edges = new[] { E(0, 0, 1, 0), E(1, 0, 2, 0), E(2, 0, 2, 1), E(2, 1, 2, 2), E(2, 2, 1, 2), E(1, 2, 0, 2), E(0, 2, 0, 1), E(0, 1, 0, 0), }; edges = TriggerZoneBuilder.MergeEdges(edges); // edges = edges.OrderBy(x => x).ToList(); Assert.Collection(edges, e => Assert.Equal(E(0, 0, 2, 0), e), e => Assert.Equal(E(0, 0, 0, 2), e), e => Assert.Equal(E(2, 0, 2, 2), e), e => Assert.Equal(E(0, 2, 2, 2), e) ); }