Sha256: ce7e83ff5c6423ec166e497204c1b4f220160da14e2a0b0200d95b9fe0d91be7

Contents?: true

Size: 489 Bytes

Versions: 233

Compression:

Stored size: 489 Bytes

Contents

require 'generator/exercise_case'

class BracketPushCase < Generator::ExerciseCase

  def workload
    long_input? ? split_test : simple_test
  end

  private

  def long_input?
    input.length > 80
  end

  def simple_test
    "#{assert} Brackets.paired?('#{input}')"
  end

  def split_test
    "str = '#{split_input[0]}'\\
          '#{split_input[1]}'
    #{assert} Brackets.paired?(str)"
  end

  def split_input
    @split_input ||= input.scan(/.{1,#{input.length / 2}}/)
  end
end

Version data entries

233 entries across 233 versions & 1 rubygems

Version Path
trackler-2.2.1.78 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.77 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.76 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.75 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.74 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.73 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.72 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.71 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.70 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.69 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.68 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.67 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.66 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.65 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.64 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.63 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.62 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.61 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.60 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.59 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb