@Test public void readMDLCoordinate_offset() throws Exception { assertThat(new MDLV2000Reader().readMDLCoordinate(" -2.0012 7.8089", 10), is(closeTo(7.8089, 0.1))); }
@Test public void readMDLCoordinate_negative() throws Exception { assertThat(new MDLV2000Reader().readMDLCoordinate(" -2.0012", 0), is(closeTo(-2.0012, 0.1))); }
@Test public void readMDLCoordinate() throws Exception { assertThat(new MDLV2000Reader().readMDLCoordinate(" 7.8089", 0), is(closeTo(7.8089, 0.1))); }
@Test public void readMDLCoordinates_no_decimal_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 708089 ", 10), is(closeTo(708089, 0.1))); } }
@Test public void readMDLCoordinates_wrong_decimal_position_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 7.8089 ", 10), is(closeTo(7.8089, 0.1))); }
@Test public void readMDLCoordinates_no_value_relaxed() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.0012 ", 10), is(closeTo(0.0, 0.1))); }
@Test public void readOldJmolCoords() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.RELAXED); assertThat(reader.readMDLCoordinate(" -2.00120 7.8089", 0), is(closeTo(-2.00120, 0.1))); }
@Test(expected = CDKException.class) public void readMDLCoordinates_wrong_decimal_position_strict() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.STRICT); assertThat(reader.readMDLCoordinate(" -2.0012 7.8089 ", 10), is(closeTo(7.8089, 0.1))); }
@Test(expected = CDKException.class) public void readOldJmolCoordsFailOnStrictRead() throws Exception { MDLV2000Reader reader = new MDLV2000Reader(); reader.setReaderMode(IChemObjectReader.Mode.STRICT); reader.readMDLCoordinate(" -2.00120 7.8089", 0); }
case 33: // symbol is left aligned case 32: x = readMDLCoordinate(line, 0); y = readMDLCoordinate(line, 10); z = readMDLCoordinate(line, 20); symbol = line.substring(31, 34).trim().intern(); break;
count = readMolfileInt(line, 10); assert count == 4; // fixed? sgroup.addBracket(new SgroupBracket(readMDLCoordinate(line, 13), readMDLCoordinate(line, 23), readMDLCoordinate(line, 33), readMDLCoordinate(line, 43))); break;