Sha256: 6f76d7a36ae756b724c88012893979648a09d25e388268525a522335c2608439

Contents?: true

Size: 515 Bytes

Versions: 25

Compression:

Stored size: 515 Bytes

Contents

require 'generator/exercise_case'

class CollatzConjectureCase < Generator::ExerciseCase
  using Generator::Underscore

  def workload
    case expected
    when Fixnum
      standard_assertion
    when Hash
      error_assertion
    end
  end

  def standard_assertion
    assert_equal { subject_of_test }
  end

  def error_assertion
    "assert_raises(ArgumentError) { #{subject_of_test} }"
  end

  def subject_of_test
    "CollatzConjecture.steps(#{input})"
  end

  def input
    number.underscore
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
trackler-2.2.1.10 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.9 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.8 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.7 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.6 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.5 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.4 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.3 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.2 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.1 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.1.0 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.6 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.5 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.4 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.3 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.2 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.1 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.2.0.0 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.1.0.55 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb
trackler-2.1.0.54 tracks/ruby/exercises/collatz-conjecture/.meta/generator/collatz_conjecture_case.rb