mirror of
https://github.com/ruby/ruby.git
synced 2026-08-03 11:18:06 +08:00
Add snapshot tests verifying correct HIR generation for each annotated method: - Float cfuncs (nan?, finite?, infinite?) emit CCall with BoolExact or Fixnum|NilClass return type - Integer builtins (zero?, even?, odd?) emit InvokeBuiltin with BoolExact return type - Float builtins (zero?, positive?, negative?) emit InvokeBuiltin with BoolExact return type Add benchmark yml files for Float and Integer predicates to the benchmark/ directory.
13 lines
403 B
YAML
13 lines
403 B
YAML
prelude: |
|
|
floats = [1.0, -1.0, 0.0, Float::NAN, Float::INFINITY, -Float::INFINITY]
|
|
|
|
benchmark:
|
|
float_nan?: floats.each { |f| f.nan? }
|
|
float_finite?: floats.each { |f| f.finite? }
|
|
float_infinite?: floats.each { |f| f.infinite? }
|
|
float_zero?: floats.each { |f| f.zero? }
|
|
float_positive?: floats.each { |f| f.positive? }
|
|
float_negative?: floats.each { |f| f.negative? }
|
|
|
|
loop_count: 1000000
|