Class MiniTest::Spec
In: lib/minitest/benchmark.rb
lib/minitest/spec.rb
Parent: Object

MiniTest::Spec — The faster, better, less-magical spec framework!

For a list of expectations, see MiniTest::Expectations.

Methods

Classes and Modules

Module MiniTest::Spec::DSL

Constants

TYPES = DSL::TYPES

Public Class methods

This is used to define a new benchmark method. You usually don‘t use this directly and is intended for those needing to write new performance curve fits (eg: you need a specific polynomial fit).

See ::bench_performance_linear for an example of how to use this.

Create a benchmark that verifies that the performance is constant.

  describe "my class" do
    bench_performance_constant "zoom_algorithm!" do |n|
      @obj.zoom_algorithm!(n)
    end
  end

Create a benchmark that verifies that the performance is exponential.

  describe "my class" do
    bench_performance_exponential "algorithm" do |n|
      @obj.algorithm(n)
    end
  end

Create a benchmark that verifies that the performance is linear.

  describe "my class" do
    bench_performance_linear "fast_algorithm", 0.9999 do |n|
      @obj.fast_algorithm(n)
    end
  end

Specifies the ranges used for benchmarking for that class.

  bench_range do
    bench_exp(2, 16, 2)
  end

See Unit::TestCase.bench_range for more details.

[Validate]