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.139 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.138 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.137 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.136 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.135 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.134 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.133 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.132 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.131 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.130 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.129 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.128 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.127 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.126 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.125 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.124 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.123 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.122 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.121 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb
trackler-2.2.1.120 tracks/ruby/exercises/bracket-push/.meta/generator/bracket_push_case.rb