Sha256: b00b5aeec9611b2911422659a21f47f8e48b4841f5d43b8a6385e8b1bbaf54f9
Contents?: true
Size: 691 Bytes
Versions: 104
Compression:
Stored size: 691 Bytes
Contents
require 'generator/exercise_case' class QueenAttackCase < Generator::ExerciseCase def workload property == 'create' ? create_workload : attack_workload end private def attack_workload """queens = Queens.new(white: #{parse_position white_queen}, black: #{parse_position black_queen}) #{assert} queens.attack?""" end def parse_position queen queen['position'].delete('() ').split(',').map{|i| i.to_i} end def create_workload raises_error? ? exception : "#{assert} #{test_case}" end def test_case "Queens.new(white: #{parse_position queen})" end def exception """assert_raises ArgumentError do #{test_case} end""" end end
Version data entries
104 entries across 104 versions & 1 rubygems