Sha256: f340f1e7d587a4aefa760d889b8bab33886d1ec18c4747bb35684b59b44230e5

Contents?: true

Size: 609 Bytes

Versions: 6

Compression:

Stored size: 609 Bytes

Contents

require 'test/unit'

$:.unshift File.expand_path('../../lib', __FILE__)
$:.unshift File.expand_path('../../ext', __FILE__)
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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
openbabel-2.3.2.1 test/test_openbabel.rb
openbabel-heroku-2.3.2.4 test/test_openbabel.rb
openbabel-heroku-2.3.2.3 test/test_openbabel.rb
openbabel-heroku-2.3.2.0 test/test_openbabel.rb
openbabel-2.3.2.0 test/test_openbabel.rb
openbabel-2.3.1.9 test/test_openbabel.rb