Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Small patch for bug 3551478
Change-Id: Ic565e6783caee915014f3d4958a243089a60ee47
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>
  • Loading branch information
johnmay authored and egonw committed Mar 23, 2013
1 parent c532191 commit 71f40a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Expand Up @@ -152,7 +152,7 @@ public static boolean isIsomorph(IAtomContainer g1, IAtomContainer g2) throws C
IQueryAtom qAtom = (IQueryAtom)atom2;
return qAtom.matches(g1.getAtom(0));
} else {
String atomSymbol = atom.getSymbol();
String atomSymbol = atom2.getSymbol();
return g1.getAtom(0).getSymbol().equals(atomSymbol);
}
}
Expand Down
Expand Up @@ -171,7 +171,7 @@ public static boolean isIsomorph(IAtomContainer sourceGraph, IAtomContainer targ
IQueryAtom qAtom = (IQueryAtom) atom2;
return qAtom.matches(sourceGraph.getAtom(0));
} else {
String atomSymbol = atom.getSymbol();
String atomSymbol = atom2.getSymbol();
return sourceGraph.getAtom(0).getSymbol().equals(atomSymbol);
}
}
Expand Down
Expand Up @@ -490,6 +490,19 @@ mol1, mol2, new BitSet(),
}
}

@Test
public void testSingleAtomMatching() throws Exception {

SmilesParser sp = new SmilesParser(DefaultChemObjectBuilder.getInstance());

IAtomContainer target = sp.parseSmiles("C");
IAtomContainer query = sp.parseSmiles("C");

Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(target, query));
Assert.assertTrue(UniversalIsomorphismTester.isIsomorph(query, target));

}

@Test
public void testSingleAtomMismatching() throws Exception {

Expand All @@ -502,7 +515,6 @@ public void testSingleAtomMismatching() throws Exception {
UniversalIsomorphismTester.isIsomorph(target, query));
Assert.assertFalse("Single nitrogen and carbon should not match",
UniversalIsomorphismTester.isIsomorph(query, target));

}

/**
Expand Down

0 comments on commit 71f40a9

Please sign in to comment.