Sha256: 68da7781ac68a6670cc62c1c65295d9cfa92db8e8b229d036205ab3a2d3abc37

Contents?: true

Size: 720 Bytes

Versions: 1

Compression:

Stored size: 720 Bytes

Contents

require File.dirname(__FILE__) + '/test_helper'

class ExtTest < Test::Unit::TestCase
  def test_conversions
    assert_in_delta 1.609344, 1.convert(:miles, :kilometres), DELTA
    assert_in_delta 1.609344, 1.0.convert(:miles, :kilometres), DELTA
    assert_in_delta 0.45359237, 1.convert(:pounds, :kilograms), DELTA
    assert_in_delta 0.00110231131092439, 1.convert(:kilograms, :tons), DELTA
    assert_in_delta 2.20462262184878, 1.convert(:kilograms, :pounds), DELTA
    assert_in_delta 1, ( 1.convert(:kilograms, :pounds) * 1.convert(:pounds, :kilograms) ), DELTA
  end
  
  def test_register
    Conversions.register(:dollars, :cents, 100.0)
    assert_in_delta 1000.0, 10.convert(:dollars, :cents), DELTA
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seamusabshere-conversions-1.3.0 test/ext_test.rb