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.137 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.136 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.135 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.134 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.133 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.132 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.131 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.130 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.129 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.128 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.127 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.126 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.125 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.124 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.123 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.122 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.121 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.120 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.119 tracks/ruby/test/generator/case_values_test.rb
trackler-2.2.1.118 tracks/ruby/test/generator/case_values_test.rb