Skip to content

Instantly share code, notes, and snippets.

@baoilleach
Created April 27, 2009 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baoilleach/102445 to your computer and use it in GitHub Desktop.
Save baoilleach/102445 to your computer and use it in GitHub Desktop.
import os
import glob
import subprocess
testprogram = """
#include <openbabel/parsmart.h>
using namespace OpenBabel;
int main(int argc, char *argv[]) {
OBSmartsPattern tmp;
return 0;
}
"""
tests = []
for header in glob.glob(os.path.join("..", "openbabel-2.2.1b3", "include", "openbabel", "*.h")):
input = open(header, "r")
for line in input:
if line.find("class OBAPI") >= 0:
tests.append((header.split("/")[-1], line.split()[2].replace(":", "")))
problems = []
for test in tests:
thistest = testprogram.replace("OBSmartsPattern", test[1]).replace("parsmart.h", test[0])
filename = "test%s.cpp" % test[1]
output = open(filename, "w")
print >> output, "#include <openbabel/mol.h>"
print >> output, thistest
output.close()
retcode = subprocess.call("g++ -L/home/demo/work/tree/lib -lopenbabel -I/home/demo/work/openbabel-2.2.1b3/include %s" % filename, shell=True)
if retcode == 0:
output = open(filename, "w")
print >> output, thistest
output.close()
retcode = subprocess.call("g++ -L/home/demo/work/tree/lib -lopenbabel -I/home/demo/work/openbabel-2.2.1b3/include %s" % filename, shell=True)
if retcode != 0:
problems.append(test)
print "\n\n", problems
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment