Sha256: ffde8e0140b3b536c72a249d4c62a0b97d6d69d0a6d2cece66be3a720310d1bb

Contents?: true

Size: 734 Bytes

Versions: 102

Compression:

Stored size: 734 Bytes

Contents

require "../exercise_generator"
require "../exercise_test_case"

class AcronymGenerator < ExerciseGenerator
  def exercise_name
    "acronym"
  end

  def test_cases
    JSON.parse(data)["abbreviate"]["cases"].map do |test_case|
      AcronymTestCase.new(test_case)
    end
  end
end

class AcronymTestCase < ExerciseTestCase
  private getter phrase : JSON::Any
  private getter description : JSON::Any
  private getter expected : JSON::Any

  def initialize(test_case)
    @phrase = test_case["phrase"]
    @description = test_case["description"]
    @expected = test_case["expected"]
  end

  def workload
    "Acronym.abbreviate(\"#{phrase}\").should eq(\"#{expected}\")"
  end

  def test_name
    "does #{description}"
  end
end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
trackler-2.2.1.92 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.91 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.90 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.89 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.88 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.87 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.86 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.85 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.84 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.83 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.82 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.81 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.80 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.79 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.78 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.77 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.76 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.75 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.74 tracks/crystal/generator/src/generators/acronym.cr
trackler-2.2.1.73 tracks/crystal/generator/src/generators/acronym.cr