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.1.0.39 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.38 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.37 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.36 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.34 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.33 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.32 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.31 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.30 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.29 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.28 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.27 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.26 tracks/ruby/test/generator/case_values_test.rb
trackler-2.1.0.25 tracks/ruby/test/generator/case_values_test.rb