Sha256: a46fd6c9048eca431fc2283a6af4df95b318dacc48d5d2203884ad7d1c15b3e2

Contents?: true

Size: 732 Bytes

Versions: 189

Compression:

Stored size: 732 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

189 entries across 189 versions & 1 rubygems

Version Path
trackler-2.1.0.12 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.11 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.10 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.9 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.8 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.7 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.6 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.5 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.4 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.3 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.2 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.1 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.1.0.0 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.55 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.54 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.53 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.52 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.51 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.50 tracks/crystal/src/generator/exercises/acronym.cr
trackler-2.0.8.49 tracks/crystal/src/generator/exercises/acronym.cr