Sha256: 2af7d7b9e7d391adc52b80f062abf39da316c0d3a5af3730ea7848828f016abf

Contents?: true

Size: 1.57 KB

Versions: 163

Compression:

Stored size: 1.57 KB

Contents

#!/usr/bin/env ruby
gem 'minitest', '>= 5.0.0'
require 'minitest/autorun'
require_relative 'octal'

class OctalTest < Minitest::Test
  def test_octal_1_is_decimal_1
    assert_equal 1, Octal.new('1').to_decimal
  end

  def test_octal_10_is_decimal_8
    skip
    assert_equal 8, Octal.new('10').to_decimal
  end

  def test_octal_17_is_decimal_15
    skip
    assert_equal 15, Octal.new('17').to_decimal
  end

  def test_octal_11_is_decimal_9
    skip
    assert_equal 9, Octal.new('11').to_decimal
  end

  def test_octal_130_is_decimal_88
    skip
    assert_equal 88, Octal.new('130').to_decimal
  end

  def test_octal_2047_is_decimal_1063
    skip
    assert_equal 1063, Octal.new('2047').to_decimal
  end

  def test_octal_7777_is_decimal_4095
    skip
    assert_equal 4095, Octal.new('7777').to_decimal
  end

  def test_octal_1234567_is_decimal_342391
    skip
    assert_equal 342_391, Octal.new('1234567').to_decimal
  end

  def test_invalid_octal_is_decimal_0
    skip
    assert_equal 0, Octal.new('carrot').to_decimal
  end

  def test_8_is_seen_as_invalid_and_returns_0
    skip
    assert_equal 0, Octal.new('8').to_decimal
  end

  def test_9_is_seen_as_invalid_and_returns_0
    skip
    assert_equal 0, Octal.new('9').to_decimal
  end

  def test_6789_is_seen_as_invalid_and_returns_0
    skip
    assert_equal 0, Octal.new('6789').to_decimal
  end

  def test_abc1z_is_seen_as_invalid_and_returns_0
    skip
    assert_equal 0, Octal.new('abc1z').to_decimal
  end

  def test_valid_octal_formatted_string_011_is_decimal_9
    skip
    assert_equal 9, Octal.new('011').to_decimal
  end
end

Version data entries

163 entries across 163 versions & 1 rubygems

Version Path
trackler-2.0.8.2 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.8.1 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.7.0 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.44 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.43 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.42 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.41 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.40 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.39 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.38 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.37 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.36 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.35 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.34 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.33 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.32 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.31 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.30 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.29 tracks/ruby/exercises/octal/octal_test.rb
trackler-2.0.6.28 tracks/ruby/exercises/octal/octal_test.rb