Sha256: f15f6e53ee97dedd5b3259a5f87574817eb8f2df15f164e8c750361bb4abbf6d
Contents?: true
Size: 749 Bytes
Versions: 2
Compression:
Stored size: 749 Bytes
Contents
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib' begin require "rspec/its" rescue LoadError $stderr.puts "Install rspec-its by: gem install rspec-its" exit(1) end require "phys/units" U = Phys::Unit Q = Phys::Quantity RSpec::Matchers.define :be_sfloat_close_to do |y| match do |x| if x==0 && y==0 true else x = x.to_f (x-y).abs/(x.abs+y.abs) < 1.2e-7 end end end RSpec::Matchers.define :be_a_quantity_close_to do |expected| match do |actual| if !(Phys::Quantity===actual && Phys::Quantity===expected) false else actual.close_to(expected,1.2e-7) end end end RSpec::Matchers.define :be_comformable_with do |expected| match do |actual| actual === expected end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
phys-units-0.9.9 | spec/helper.rb |
phys-units-0.9.8 | spec/helper.rb |