public void Accessors() { UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher()); state.size = 1; Assert.AreEqual(state.Count, 1); Assert.AreEqual(state.NMax(), state.g1.Length); Assert.AreEqual(state.MMax(), state.g2.Length); }
public void Mapping() { UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher()); state.m1[0] = 1; state.m1[1] = 2; Assert.IsTrue(Compares.AreDeepEqual(state.m1, state.Mapping())); Assert.AreNotSame(state.m1, state.Mapping()); }
public void TestNextM() { UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher()); Assert.AreEqual(state.NextM(0, -1), 0); Assert.AreEqual(state.NextM(0, 0), 1); Assert.AreEqual(state.NextM(0, 1), 2); state.m2[1] = 0; // 1 has been mapped and should be skipped over Assert.AreEqual(state.NextM(0, 0), 2); }
public void TestNextN() { UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher()); Assert.AreEqual(state.NextN(0), 0); state.size = 1; Assert.AreEqual(state.NextN(0), 1); state.size = 2; Assert.AreEqual(state.NextN(0), 2); }
public void Add() { UllmannState state = CreateBenzeneToNaphthalene(AtomMatcher.CreateAnyMatcher(), BondMatcher.CreateAnyMatcher()); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, new[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } }, state.matrix.Fix() )); Assert.IsTrue(state.Add(0, 0)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, 1, -1, -1, -1, 1, -1, 1 }, new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 } }, state.matrix.Fix())); Assert.IsTrue(state.Add(1, 9)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { 1, -1, -2, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, -2, -1, -1, -1, 1, -1, 1 }, new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 } }, state.matrix.Fix())); Assert.IsTrue(state.Add(2, 8)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, 1 }, new[] { 1, -1, 1, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 } }, state.matrix.Fix())); Assert.IsTrue(state.Add(3, 7)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 }, new[] { -4, -1, 1, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, 1 } }, state.matrix.Fix())); Assert.IsTrue(state.Add(4, 2)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 }, new[] { -4, -1, 1, -1, -1, -1, -1, -1, -5, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, -5 } }, state.matrix.Fix())); Assert.IsTrue(state.Add(5, 1)); Assert.IsTrue(Compares.AreDeepEqual( new int[][] { new[] { 1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, new[] { -1, -2, -1, -1, -1, -1, -1, -1, -1, 1 }, new[] { -3, -1, -2, -1, -1, -1, -1, -1, 1, -1 }, new[] { -1, -3, -1, -2, -1, -1, -1, 1, -1, -4 }, new[] { -4, -1, 1, -1, -1, -1, -1, -1, -5, -1 }, new[] { -1, 1, -1, -1, -1, -1, -1, -1, -1, -5 } }, state.matrix.Fix())); }