Sha256: db91c66e98326513b8bcecba7e0b6661fa01853c7a59dc9e096dbbd103e6835a

Contents?: true

Size: 1.35 KB

Versions: 233

Compression:

Stored size: 1.35 KB

Contents

require 'generator/exercise_case'

class CustomSetCase < Generator::ExerciseCase

  def workload
    send property
  end

  private

  def union
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    expected = CustomSet.new #{expected}
    #{assert}_equal expected, set1.union(set2)"
  end

  def difference
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    expected = CustomSet.new #{expected}
    #{assert}_equal expected, set1.difference(set2)"
  end

  def intersection
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    expected = CustomSet.new #{expected}
    #{assert}_equal expected, set2.intersection(set1)"
  end

  def add
    "set = CustomSet.new #{set}
    expected = CustomSet.new #{expected}
    #{assert}_equal expected, set.add(#{element})"
  end

  def equal
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    #{assert}_equal set1, set2"
  end

  def disjoint
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    #{assert} set1.disjoint? set2"
  end

  def subset
    "set1 = CustomSet.new #{set1}
    set2 = CustomSet.new #{set2}
    #{assert} set1.subset? set2"
  end

  def empty
    "set = CustomSet.new #{set}
    #{assert}_empty set"
  end

  def contains
    "set = CustomSet.new #{set}
    element = #{element}
    #{assert} set.member? element"
  end

end

Version data entries

233 entries across 233 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.179 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.178 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.177 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.176 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.175 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.174 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.173 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.172 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.171 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.170 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.169 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.167 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.166 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.165 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.164 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.163 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.162 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.161 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb
trackler-2.2.1.160 tracks/ruby/exercises/custom-set/.meta/generator/custom_set_case.rb