Sha256: 52cbaff56861fdb5d647951250e132c158f63cc8f10a0af19296736ce62178c3
Contents?: true
Size: 544 Bytes
Versions: 233
Compression:
Stored size: 544 Bytes
Contents
require 'generator/exercise_case' class GrainsCase < Generator::ExerciseCase def workload send("#{property}_workload") end private def square_workload if raises_error? "assert_raises(ArgumentError) { Grains.square(#{input}) }" else "assert_equal #{underscore_format(expected)}, Grains.square(#{input})" end end def total_workload "assert_equal #{underscore_format(expected)}, Grains.total" end def underscore_format(number) number.to_s.reverse.gsub(/...(?=.)/, '\&_').reverse end end
Version data entries
233 entries across 233 versions & 1 rubygems