mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Fix i-files for RDK_USE_BOOST_IOSTREAMS=OFF (#4933)
* fix i-files for RDK_USE_BOOST_IOSTREAMS=OFF * separate gzstream test Co-authored-by: Kazuya Ujihara <ujihara@preferred.jp>
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
|
||||
%include <GraphMol/FileParsers/MolSupplier.h>
|
||||
|
||||
#ifdef RDK_USE_BOOST_IOSTREAMS
|
||||
%extend RDKit::ForwardSDMolSupplier {
|
||||
ForwardSDMolSupplier(RDKit::gzstream *strm, bool sanitize=true, bool removeHs = true,
|
||||
bool strictParsing = true) {
|
||||
@@ -66,6 +67,7 @@
|
||||
return foo;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
%include <GraphMol/Resonance.h>
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace std {
|
||||
class istream;
|
||||
}
|
||||
|
||||
#ifdef RDK_USE_BOOST_IOSTREAMS
|
||||
%extend RDKit::gzstream {
|
||||
std::istream* _GetStream() { return (std::istream*)$self; }
|
||||
std::string Dump() {
|
||||
@@ -68,6 +69,7 @@ class istream;
|
||||
return streamRef;
|
||||
}
|
||||
%}
|
||||
#endif
|
||||
|
||||
%include <../RDStreams/streams.h>
|
||||
|
||||
|
||||
@@ -173,6 +173,10 @@ if(NOT RDK_BUILD_INCHI_SUPPORT)
|
||||
LIST(REMOVE_ITEM JAVA_TEST_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src-test/org/RDKit/InchiTests.java")
|
||||
endif()
|
||||
|
||||
if(NOT RDK_USE_BOOST_IOSTREAMS)
|
||||
LIST(REMOVE_ITEM JAVA_TEST_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src-test/org/RDKit/GzStreamTests.java")
|
||||
endif()
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_JAVA_TEST_OUTDIR}/org/RDKit/WrapperTests.class
|
||||
COMMAND ${JAVA_COMPILE} ${DOCLINT_FLAGS} -d ${CMAKE_JAVA_TEST_OUTDIR} -cp "\"${CMAKE_CURRENT_SOURCE_DIR}/org.RDKit.jar${PATH_SEP}${JUNIT_JAR}\"" ${JAVA_TEST_FILES}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.RDKit;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
public class GzStreamTests extends GraphMolTest {
|
||||
|
||||
@Test
|
||||
public void test11GZstream() {
|
||||
// NCI_aids_few.sdf.gz
|
||||
File base = getRdBase();
|
||||
File gzpath = new File(base, "Code" + File.separator + "GraphMol" + File.separator +
|
||||
"FileParsers" + File.separator + "test_data");
|
||||
File fileN = new File(gzpath, "NCI_aids_few.sdf.gz");
|
||||
assertTrue(fileN.exists());
|
||||
gzstream stream = new gzstream(fileN.getPath());
|
||||
ForwardSDMolSupplier suppl = new ForwardSDMolSupplier(stream);
|
||||
assertFalse(suppl.atEnd());
|
||||
ArrayList<ROMol> ms = new ArrayList<ROMol>();
|
||||
ROMol m;
|
||||
do {
|
||||
m = suppl.next();
|
||||
if (m != null)
|
||||
ms.add(m);
|
||||
} while (!suppl.atEnd());
|
||||
assertEquals(16, ms.size());
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
org.junit.runner.JUnitCore.main("org.RDKit.GzStreamTests");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -167,28 +167,6 @@ public class SuppliersTests extends GraphMolTest {
|
||||
if((i%1000)==0) System.err.printf("Done: %s\n",i);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test11GZstream() {
|
||||
// NCI_aids_few.sdf.gz
|
||||
File base = getRdBase();
|
||||
File gzpath = new File(base, "Code" + File.separator + "GraphMol" + File.separator +
|
||||
"FileParsers" + File.separator + "test_data");
|
||||
File fileN = new File(gzpath, "NCI_aids_few.sdf.gz");
|
||||
assertTrue(fileN.exists());
|
||||
gzstream stream = new gzstream(fileN.getPath());
|
||||
ForwardSDMolSupplier suppl = new ForwardSDMolSupplier(stream);
|
||||
assertFalse(suppl.atEnd());
|
||||
ArrayList<ROMol> ms = new ArrayList<ROMol>();
|
||||
ROMol m;
|
||||
do {
|
||||
m = suppl.next();
|
||||
if (m != null)
|
||||
ms.add(m);
|
||||
} while (!suppl.atEnd());
|
||||
assertEquals(16, ms.size());
|
||||
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
org.junit.runner.JUnitCore.main("org.RDKit.SuppliersTests");
|
||||
|
||||
Reference in New Issue
Block a user