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.16 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.15 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.14 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.13 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.12 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.11 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.10 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.9 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.8 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.7 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.6 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.5 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.4 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.3 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.2 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.1 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.0 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.0.6 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.0.5 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.0.4 tracks/ruby/test/generator/case_values_test.rb