Parser { static Graph parse(String str) throws InvalidSmilesException { return new Parser(str).molecule(); } Parser(CharBuffer buffer, boolean strict);   Parser(String str); List<Edge> getEdges(LocalArrangement localArrangement, int u); int[] getAlleneCarriers(int focus); Collection<? extends String> getWarnings();  }
@Test(expected = InvalidSmilesException.class) public void unclosedBranch2() throws Exception { Parser.parse("CCCC(CCC(CC)"); }
@Test(expected = InvalidSmilesException.class) public void unopenedBranch1() throws Exception { Parser.parse("CCCCCC)CCC"); }
@Test(expected = InvalidSmilesException.class) public void unopenedBranch2() throws Exception { Parser.parse("CCCCCC))CCC"); }
@Test public void tellurophene() throws InvalidSmilesException { Parser.parse("c1cc[te]c1"); }
@Test public void mixingAromaticAndKekule() throws InvalidSmilesException { Graph g = Parser.parse("C:1:C:C:C:C:C1"); for (Edge e : g.edges()) { assertThat(e.bond(), is(Bond.AROMATIC)); } }
@Test public void largeRnum() throws Exception { Graph g = Parser.parse("C%99CCCC%99"); }
@Test public void r_label() throws InvalidSmilesException { Graph g = Parser.parse("CC(C)C[R]"); assertThat(g.atom(4).label(), is("R")); }
@Test public void random_label() throws InvalidSmilesException { Graph g = Parser.parse("CC(C)C[Really?]"); assertThat(g.atom(4).label(), is("Really?")); }
@Test(expected = InvalidSmilesException.class) public void bad_label() throws Exception { Parser.parse("[Nope-[not]-[ok]"); }
@Test(expected = InvalidSmilesException.class) public void bad_label2() throws Exception { Parser.parse("[this-[is-not-okay]"); }
@Test public void nested_label() throws InvalidSmilesException { Graph g = Parser.parse("CCCCCCC=CCCCCCCCC=CC(=O)[a holo-[acyl-carrier protein]]"); assertThat(g.atom(g.order() - 1).label(), is("a holo-[acyl-carrier protein]")); }
@Test public void seleniumTh() throws Exception { assertThat(Parser.parse("[Se@](=O)(C)CC").toSmiles(), is("[Se@](=O)(C)CC")); }
@Test public void sulphurIonTh() throws Exception { assertThat(Parser.parse("[S@+]([O-])(C)CC").toSmiles(), is("[S@+]([O-])(C)CC")); }
@Test(expected = InvalidSmilesException.class) public void rejectChEMBLBadBonds() throws Exception { Parser.parse("C\\=C"); }
@Test public void acceptMultipleBonds() throws Exception { Parser.parse("C/C=C/C\\C=C/C"); }
@Test public void parseTitleSpace() throws Exception { Graph g = Parser.parse("CCO ethanol"); assertThat(g.getTitle(), is("ethanol")); }
@Test public void parseTitleTab() throws Exception { Graph g = Parser.parse("CCO\tethanol"); assertThat(g.getTitle(), is("ethanol")); }
@Test public void parseTitleTabNewline() throws Exception { Graph g = Parser.parse("CCO\tethanol\n"); assertThat(g.getTitle(), is("ethanol")); }
@Test public void parseTH7() throws Exception { Graph g = Parser.parse("CC=C=C=[C@]=C=C=CC"); assertThat(g.topologyOf(4).configuration(), is(Configuration.AL1)); assertThat(g.permute(new int[]{1,0,2,3,4,5,6,7,8}) .toSmiles(), is("C(C)=C=C=[C@@]=C=C=CC")); }
@Ignore @Test(expected = InvalidSmilesException.class) public void chembl345045Mangled() throws Exception { Parser.parse("c1c(ccc(c1)F)c2/c3n/c(c(\\c4[nH]c(/c(c/5\\nc(/c(c/6\\s\\c2\\cc6)/c7ccc(cc7)F)C=C5)/c8ccc(cc8)S(=O)(=O)[O-])cc4)/c9ccc(cc9)S(=O)(=O)[O-])/C=C3.[Na+].[Na+] CHEMBL345045"); }
@Test(expected = InvalidSmilesException.class) public void openBracketIsInvalid() throws Exception { Parser.parse("["); }
@Test public void invalidTetrahedral() throws InvalidSmilesException { Graph g = Parser.parse("[C@-](N)(O)C"); Assert.assertThat(g.topologyOf(0), is(Topology.unknown())); }
@Test public void invalidTetrahedral2() throws InvalidSmilesException { Graph g = Parser.parse("[C@](N)(O)C"); Assert.assertThat(g.topologyOf(0), is(Topology.unknown())); }
@Test(expected = InvalidSmilesException.class) public void unclosedRing1() throws Exception { Parser.parse("C1CCCCC"); }
@Test(expected = InvalidSmilesException.class) public void unclosedRing2() throws Exception { Parser.parse("C1CCCCC1CCCC1CCCC"); }
@Test(expected = InvalidSmilesException.class) public void unclosedBranch1() throws Exception { Parser.parse("CCCC(CCCC"); }