summaryrefslogtreecommitdiff
path: root/test/compound.rb
diff options
context:
space:
mode:
authordavor <vorgrimmlerdavid@gmx.de>2015-10-29 13:33:30 +0000
committerdavor <vorgrimmlerdavid@gmx.de>2015-10-29 13:33:30 +0000
commit7fc34ea47526bfd5e23441fc00d9149ee13d3089 (patch)
tree0742896b3e1fd18f1c1b6ba7ee4252dcbc9ec5d3 /test/compound.rb
parent61fda66b5bc86e600b27f9a2c2eaea97603fbb92 (diff)
Added molecular weight to compound and mg conversions
Added tests
Diffstat (limited to 'test/compound.rb')
-rw-r--r--test/compound.rb14
1 files changed, 14 insertions, 0 deletions
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