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.36 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.35 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.34 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.33 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.32 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.31 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.30 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.29 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.28 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.27 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.26 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.25 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.24 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.23 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.22 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.21 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.20 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.19 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.18 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.17 tracks/ruby/test/generator/case_values_test.rb