Sha256: 35bf7c721a06c8ee3081bc948140060296d78e1218a5613b72f905bc32408242

Contents?: true

Size: 738 Bytes

Versions: 58

Compression:

Stored size: 738 Bytes

Contents

require 'exercise_cases'

class PangramCase < OpenStruct
  def name
    'test_%s' % description.downcase.tr_s(" -'", '_').sub(/_$/, '')
  end

  def workload
    [
    "phrase = '#{input}'",
    "    result = Pangram.pangram?(phrase)",
    "    #{assertion} result, \"#{message}\""
    ].join("\n")
  end

  def message
    "Expected #{expected}, got: \#{result.inspect}. \#{phrase.inspect} #{is_or_isnt} a pangram"
  end

  def is_or_isnt
    expected ? 'IS' : 'is NOT'
  end

  def assertion
    expected ? 'assert' : 'refute'
  end

  def skipped?
    index.zero? ? '# skip' : 'skip'
  end
end

PangramCases = proc do |data|
  JSON.parse(data)['cases'].map.with_index do |row, i|
    PangramCase.new(row.merge('index' => i))
  end
end

Version data entries

58 entries across 58 versions & 1 rubygems

Version Path
trackler-2.1.0.1 tracks/ruby/lib/pangram_cases.rb
trackler-2.1.0.0 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.55 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.54 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.53 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.52 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.51 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.50 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.49 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.48 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.47 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.46 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.45 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.44 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.43 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.42 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.41 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.40 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.39 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.38 tracks/ruby/lib/pangram_cases.rb