Sha256: 0cb6e1f795aff45efc42c50dfa328a1b7f5f6dc8aeb421595e38f9538c4806b9
Contents?: true
Size: 768 Bytes
Versions: 6
Compression:
Stored size: 768 Bytes
Contents
require 'spec_helper' require 'mspire/molecular_formula' describe Mspire::MolecularFormula do it 'can be initialized with a String or Hash' do data = {h: 22, c: 12, n: 1, o: 3, s: 2} mf = Mspire::MolecularFormula.new "H22BeC12N1O3S2Li2" mf.should == {:h=>22, :be=>1, :c=>12, :n=>1, :o=>3, :s=>2, :li=>2} mf = Mspire::MolecularFormula.new(data) mf.should == data end it 'expects properly capitalized abbreviations' do Mspire::MolecularFormula.new('Ni7Se3').should == {:ni=>7, :se=>3} # there is no such thing as the E element, so this is going to get the # user in trouble. However, this is the proper interpretation of the # formula. Mspire::MolecularFormula.new('Ni7SE3').should == {:ni=>7, :s=>1, :e=>3} end end
Version data entries
6 entries across 6 versions & 1 rubygems