Sha256: 82b0ec6fd5c7b008e750c778a776debdaf2a369e70918a6e753321250c0a0ce4

Contents?: true

Size: 1.48 KB

Versions: 12

Compression:

Stored size: 1.48 KB

Contents

# Test facets/multipliers.rb

require 'facets/multipliers.rb'
require 'test/unit'

class TC_Multipliers < Test::Unit::TestCase

  def test_deka
    assert_equal( 10, 1.deka )
  end

  def test_hecto
    assert_equal( 100, 1.hecto )
  end

  def test_kilo
    assert_equal( 1000, 1.kilo )
  end

  def test_mega
    assert_equal( 1000000, 1.mega )
  end

  def test_giga
    assert_equal( 1000000000, 1.giga )
  end

  def test_tera
    assert_equal( 1000000000000, 1.tera )
  end

  def test_peta
    assert_equal( 1000000000000000, 1.peta )
  end

  def test_exa
    assert_equal( 1000000000000000000, 1.exa )
  end

  # Fractional

  def test_deci
    assert_equal( 0.1, 1.deci )
  end

  def test_centi
    assert_equal( 0.01, 1.centi )
  end

  def test_milli
    assert_equal( 0.001, 1.milli )
  end

  def test_micro
    assert_equal( 0.000001, 1.micro )
  end

  def test_nano
    assert_equal( 0.000000001, 1.nano )
  end

  def test_pico
    assert_equal( 0.000000000001, 1.pico )
  end

  def test_femto
    assert_equal( 0.000000000000001, 1.femto )
  end

  def test_atto
    assert_equal( 0.000000000000000001, 1.atto )
  end

  # SI Binary

  def test_kibi
    assert_equal( 1024, 1.kibi )
  end

  def test_mebi
    assert_equal( 1024**2, 1.mebi )
  end

  def test_gibi
    assert_equal( 1024**3, 1.gibi )
  end

  def test_tebi
    assert_equal( 1024**4, 1.tebi )
  end

  def test_pebi
    assert_equal( 1024**5, 1.pebi )
  end

  def test_exbi
    assert_equal( 1024**6, 1.exbi )
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
facets-2.8.4 test/more/test_multipliers.rb
facets-2.8.3 test/more/test_multipliers.rb
facets-2.8.2 test/more/test_multipliers.rb
facets-2.8.1 test/more/test_multipliers.rb
facets-2.8.0 test/more/test_multipliers.rb
facets-2.7.0 test/more/test_multipliers.rb
facets-2.6.0 test/more/test_multipliers.rb
facets-2.4.4 test/more/test_multipliers.rb
facets-2.5.1 test/more/test_multipliers.rb
facets-2.5.0 test/more/test_multipliers.rb
facets-2.4.5 test/more/test_multipliers.rb
facets-2.5.2 test/more/test_multipliers.rb