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.0.8.16 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.15 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.14 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.13 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.12 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.11 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.10 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.9 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.8 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.7 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.6 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.5 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.4 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.3 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.2 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.8.1 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.7.0 tracks/ruby/lib/pangram_cases.rb
trackler-2.0.6.44 tracks/ruby/lib/pangram_cases.rb