File: metric_spec.rb

package info (click to toggle)
ruby-benchmark-memory 0.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 300 kB
  • sloc: ruby: 1,121; makefile: 7; sh: 4
file content (17 lines) | stat: -rw-r--r-- 438 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Benchmark::Memory::Measurement::Metric do
  describe '#to_s' do
    it 'is of consistent length' do
      examples = [0, 100, 1_000, 1_000_000, 1_000_000_000, 1_000_000_000_000]
      lengths = examples.map do |i|
        metric = described_class.new(:fake, i * 2, i)
        metric.to_s.length
      end

      expect(lengths.min).to eq(lengths.max)
    end
  end
end