Sha256: 28f3ed1c30d113952044d7b26821afdc51df22a66f46999b439ade9df3ff52ff

Contents?: true

Size: 698 Bytes

Versions: 16

Compression:

Stored size: 698 Bytes

Contents

require File.expand_path("../../../test_helper", __FILE__)
require 'virtualbox/ext/byte_normalizer'

class ByteNormalizerTest < Test::Unit::TestCase
  class A
    include VirtualBox::ByteNormalizer
  end

  setup do
    @instance = A.new
  end

  should "convert megabytes to bytes" do
    expected = {
      1 => 1_048_576,
      345.4 => 362_178_150.4
    }

    expected.each do |input, out|
      assert_equal out, @instance.megabytes_to_bytes(input)
    end
  end

  should "convert bytes to megabytes" do
    expected = {
      1_048_576 => 1,
      362_178_150.4 => 345.4
    }

    expected.each do |input, out|
      assert_equal out, @instance.bytes_to_megabytes(input)
    end
  end
end

Version data entries

16 entries across 16 versions & 3 rubygems

Version Path
virtualbox-0.9.2 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.9.1 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.9.0 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.6 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.5 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.4 test/virtualbox/ext/byte_normalizer_test.rb
velir_virtualbox-0.8.4 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.3 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.2 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.1 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.8.0 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.7.9 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.7.8 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.7.7 test/virtualbox/ext/byte_normalizer_test.rb
virtualbox-0.7.6 test/virtualbox/ext/byte_normalizer_test.rb
bbrowning-virtualbox-0.7.6.dev test/virtualbox/ext/byte_normalizer_test.rb