示例#1
0
        public void InfeasibleTerminalCount()
        {
            VFState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher());

            Assert.IsTrue(state.Feasible(4, 4)); // 4, 4 is feasible
            state.Add(0, 0);
            state.Add(1, 1);
            state.Add(2, 2);
            state.Add(3, 3);
            Assert.IsFalse(state.Feasible(4, 4)); // 4, 4 is infeasible
        }
示例#2
0
        public void InfeasibleAtoms()
        {
            var m = new Mock <AtomMatcher>(); AtomMatcher mock = m.Object;

            m.Setup(n => n.Matches(It.IsAny <IAtom>(), It.IsAny <IAtom>())).Returns(false);
            VFState state = CreateBenzeneToNaphthalene(mock, new Mock <BondMatcher>().Object);

            for (int i = 0; i < state.NMax(); i++)
            {
                for (int j = 0; j < state.MMax(); j++)
                {
                    Assert.IsFalse(state.Feasible(i, j));
                }
            }
        }
示例#3
0
        public void AddNonFeasible()
        {
            AbstractVFState state = new VFState(new int[4][], new int[6][], false);

            Assert.IsFalse(state.Add(0, 1));
            Assert.AreEqual(0, state.size);
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[] { UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED },
                              state.m1));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[] { UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED, UNMAPPED },
                              state.m2));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[] { 0, 0, 0, 0 },
                              state.t1));
            Assert.IsTrue(Compares.AreDeepEqual(
                              new int[] { 0, 0, 0, 0, 0, 0 },
                              state.t2));
        }
示例#4
0
        public void InfeasibleBonds()
        {
            var m = new Mock <BondMatcher>(); BondMatcher mock = m.Object;

            m.Setup(n => n.Matches(It.IsAny <IBond>(), It.IsAny <IBond>())).Returns(false);
            VFState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), mock);

            state.m1[0] = 0;
            state.m1[1] = 1;
            state.m1[2] = 2;
            state.m1[3] = 3;
            state.m1[4] = 4;
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Assert.IsFalse(state.Feasible(i, j));
                }
            }
        }