public void TestItShouldHaveANextCandidateInTheSecondaryState() { IState state = new VFState(benzeneQuery, new TargetProperties(benzene)); Match match = new Match(benzeneQuery.GetNode(0), benzene.Atoms[0]); IState nextState = state.NextState(match); Assert.IsTrue(nextState.HasNextCandidate()); }
public void TestItShouldFindAllMatchCandidatesInTheRootState() { IState state = new VFState(benzeneQuery, new TargetProperties(benzene)); int count = 0; while (state.HasNextCandidate()) { state.NextCandidate(); count++; } Assert.AreEqual(benzene.Atoms.Count * benzene.Atoms.Count, count); }
public void TestItShoudFindAllMatchCandidatesInThePrimaryState() { IState state = new VFState(benzeneQuery, new TargetProperties(benzene)); Match match = new Match(benzeneQuery.GetNode(0), benzene.Atoms[0]); IState newState = state.NextState(match); var candidates = new List <Match>(); while (newState.HasNextCandidate()) { candidates.Add(newState.NextCandidate()); } Assert.AreEqual(4, candidates.Count); }
public void TestItShouldMapAllAtomsInTheSecondaryState() { IState state0 = new VFState(benzeneQuery, new TargetProperties(benzene)); Match match0 = new Match(benzeneQuery.GetNode(0), benzene.Atoms[0]); IState state1 = state0.NextState(match0); Match match1 = new Match(benzeneQuery.GetNode(1), benzene.Atoms[1]); IState state2 = state1.NextState(match1); var map = state2.GetMap(); Assert.AreEqual(2, map.Count); Assert.AreEqual(benzene.Atoms[0], map[benzeneQuery.GetNode(0)]); Assert.AreEqual(benzene.Atoms[1], map[benzeneQuery.GetNode(1)]); }
public void TestItShouldFindAllMatchCandidatesInTheSecondaryState() { IState state0 = new VFState(benzeneQuery, new TargetProperties(benzene)); Match match0 = new Match(benzeneQuery.GetNode(0), benzene.Atoms[0]); IState state1 = state0.NextState(match0); Match match1 = new Match(benzeneQuery.GetNode(1), benzene.Atoms[1]); IState state2 = state1.NextState(match1); List <Match> candidates = new List <Match>(); while (state2.HasNextCandidate()) { candidates.Add(state2.NextCandidate()); } Assert.AreEqual(1, candidates.Count); }
public void TestItShouldReachGoalWhenAllAtomsAreMapped() { IState state0 = new VFState(benzeneQuery, new TargetProperties(benzene)); Match match0 = new Match(benzeneQuery.GetNode(0), benzene.Atoms[0]); IState state1 = state0.NextState(match0); Match match1 = new Match(benzeneQuery.GetNode(1), benzene.Atoms[1]); IState state2 = state1.NextState(match1); Match match2 = new Match(benzeneQuery.GetNode(2), benzene.Atoms[2]); IState state3 = state2.NextState(match2); Match match3 = new Match(benzeneQuery.GetNode(3), benzene.Atoms[3]); IState state4 = state3.NextState(match3); Match match4 = new Match(benzeneQuery.GetNode(4), benzene.Atoms[4]); IState state5 = state4.NextState(match4); Assert.IsFalse(state5.IsGoal); Match match5 = new Match(benzeneQuery.GetNode(5), benzene.Atoms[5]); IState state6 = state5.NextState(match5); Assert.IsTrue(state6.IsGoal); }