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.98 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.97 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.96 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.95 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.94 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.93 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.92 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.91 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.90 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.89 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.88 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.87 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.86 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.85 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.84 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.83 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.82 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.81 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.80 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.79 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb