module Microtest::Formatter

Defined in:

microtest/formatter.cr

Constant Summary

DEFAULT_DURATION_COLORING_SCALE = [:dark_gray, :yellow, :red, :light_red]
TIME_UNITS = {day: TimeUnit.new("d", "day", (24 * 60) * 60), hour: TimeUnit.new("h", "hour", 60 * 60), minute: TimeUnit.new("m", "minute", 60), second: TimeUnit.new("s", "second", 1), millisecond: TimeUnit.new("ms", "millisecond", 10.0 ** -3), microsecond: TimeUnit.new("µs", "microsecond", 10.0 ** -6), nanosecond: TimeUnit.new("ns", "nanosecond", 10.0 ** -9)}.to_h

Class Method Summary

Class Method Detail

def self.colorize_duration(duration : Time::Span, threshold : Time::Span, colors = DEFAULT_DURATION_COLORING_SCALE) #

[View source]
def self.format_duration(span : Time::Span) #

format_duration(15.milliseconds)) #=> {15, :millisecond} format_duration(1000.milliseconds)) #=> {1, :second}


[View source]
def self.format_large_number(number : Int32, separator : String = ",") #

format_large_number(1234567) #=> "1,234,567"


[View source]