From 7fc34ea47526bfd5e23441fc00d9149ee13d3089 Mon Sep 17 00:00:00 2001 From: davor Date: Thu, 29 Oct 2015 13:33:30 +0000 Subject: Added molecular weight to compound and mg conversions Added tests --- test/compound.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/compound.rb') diff --git a/test/compound.rb b/test/compound.rb index 22c152b..3857a85 100644 --- a/test/compound.rb +++ b/test/compound.rb @@ -174,4 +174,18 @@ print c.sdf p neighbors end end + + def test_molecular_weight + c = OpenTox::Compound.from_smiles "CC(=O)CC(C)C" + assert_equal 100.15888, c.molecular_weight + end + + def test_mg_conversions + c = OpenTox::Compound.from_smiles "O" + mw = c.molecular_weight + assert_equal 18.01528, mw + assert_equal 0.8105107141417474, c.logmmol_to_mg(4.34688225631145, mw) + assert_equal 9007.64, c.mmol_to_mg(500, mw) + assert_equal 2437.9999984148976, c.logmg_to_mg(3.387033701) + end end -- cgit v1.2.3