Sha256: a2bdf11bd871c9b8e6d27a539f0157a92cb727ef12e201921d87c78685a956ba

Contents?: true

Size: 536 Bytes

Versions: 233

Compression:

Stored size: 536 Bytes

Contents

require 'generator/exercise_case'

class RunLengthEncodingCase < Generator::ExerciseCase

  def name
    super.sub('test_',"test_#{property}_")
  end

  def workload
    indent_lines([
      "input = '#{input}'",
      "output = '#{expected}'",
      assertion
    ], 4)
  end

  private

  def assertion
    if property == 'consistency'
      'assert_equal output,
                 RunLengthEncoding.decode(RunLengthEncoding.encode(input))'
    else
      "assert_equal output, RunLengthEncoding.#{property}(input)"
    end
  end

end

Version data entries

233 entries across 233 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.179 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.178 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.177 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.176 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.175 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.174 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.173 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.172 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.171 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.170 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.169 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.167 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.166 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.165 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.164 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.163 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.162 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.161 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb
trackler-2.2.1.160 tracks/ruby/exercises/run-length-encoding/.meta/generator/run_length_encoding_case.rb