Sha256: 8a8c98d0bef3c7dd52e155753297983ae3145bde2f468bc144614770fc4907c8

Contents?: true

Size: 1.44 KB

Versions: 174

Compression:

Stored size: 1.44 KB

Contents

require_relative '../test_helper'

module Generator
  class ComplexCase < ExerciseCase
    def workload
      assert { Complex.foo(bar) }
    end
  end

  module CaseValues
    class ExtractorTest < Minitest::Test
      def test_multi_level_auto_extraction
        canonical_data = File.read('test/fixtures/metadata/exercises/complex/canonical-data.json')
        cases = Extractor.new(
          case_class: ComplexCase,
        ).cases(canonical_data)

        expected = [
          ComplexCase.new(
            canonical: {
              'description' => 'first generic verse',
              'property' => 'verse',
              'number' => 99,
              'expected' => '99 bottles of beer on the wall, YAAAR'
            }
          ),
          ComplexCase.new(
            canonical: {
              'description' => 'last generic verse',
              'property' => 'verse',
              'number' => 3,
              'expected' => '3 bottles of beer on the wall, YAAAR'
            }
          ),
          ComplexCase.new(
            canonical: {
              'description' => 'first two verses',
              'property' => 'verses',
              'beginning' => 99,
              'end' => 98,
              'expected' => "99 bottles of beer on the wall, YAR, PIRATES CAN'T COUNT"
            }
          )
        ]
        assert expected.zip(cases).all? do |exp, cs|
          assert_equal exp.canonical, cs.canonical
        end
      end
    end
  end
end

Version data entries

174 entries across 174 versions & 1 rubygems

Version Path
trackler-2.2.1.96 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.95 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.94 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.93 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.92 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.91 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.90 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.89 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.88 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.87 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.86 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.85 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.84 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.83 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.82 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.81 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.80 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.79 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.78 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.77 tracks/ruby/test/generator/case_values_test.rb