diff options
author | Andreas Maunz <andreas@maunz.de> | 2012-03-29 10:43:26 +0200 |
---|---|---|
committer | Andreas Maunz <andreas@maunz.de> | 2012-03-29 10:43:26 +0200 |
commit | a0d99ccf4d2120dff26b2625a4bc1f5eca350f2b (patch) | |
tree | 1739cc22344450bcd9bafc298b709cf538f6c047 /test |
first commit
Diffstat (limited to 'test')
-rw-r--r-- | test/test_openbabel.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_openbabel.rb b/test/test_openbabel.rb new file mode 100644 index 0000000..40f0cf9 --- /dev/null +++ b/test/test_openbabel.rb @@ -0,0 +1,21 @@ +require 'test/unit' +require 'openbabel' +include OpenBabel + +class OBTest < Test::Unit::TestCase + def test_obmol + # Code from http://goo.gl/9H1LZ + + smi2mol = OBConversion.new + smi2mol.set_in_format("smi") + + mol = OBMol.new + smi2mol.read_string(mol, 'CC(C)CCCC(C)C1CCC2C1(CCC3C2CC=C4C3(CCC(C4)O)C)C') # cholesterol, no chirality + mol.add_hydrogens + + assert_equal(mol.num_atoms, 74) + assert_in_delta(mol.get_mol_wt, 386.65, 0.1) + assert_equal(mol.get_formula, "C27H46O") + + end +end |