Sha256: fb9b943e3970cc9c04bf553eea3897d987a28014a4d4b0a2f9740eab9e396419
Contents?: true
Size: 1013 Bytes
Versions: 6
Compression:
Stored size: 1013 Bytes
Contents
require 'spec_helper' describe Numeric do it 'should clamp numbers' do 5.clamp(1, 3).should == 3 5.clamp(0, 6).should == 5 5.clamp(6, 8).should == 6 end it 'should lerp numbers' do 5.lerp(10, 0).should eq 5 5.lerp(10, 0.5).should eq 7.5 5.lerp(10, 1.0).should eq 10 5.lerp(10, 2.0).should eq 10 end it 'should report formatted time accurately' do 0.to_formatted_time.should eq '00:00' (60.75).to_formatted_time.should eq '01:01' (673.2).to_formatted_time.should eq '11:13' end it 'should describe periods accurately' do 3600.to_period.should eq '1h' 7260.to_period.should eq '2h 1m' (86400 + 10).to_period.should eq '1d 10s' end it 'should describe periods non-abbreviated' do 3600.to_period(true, false).should eq '1 hour' 7260.to_period(true, false).should eq '2 hours, 1 minute' (86400 + 10).to_period(true, false).should eq '1 day, 10 seconds' (86400 + 1).to_period(true, false).should eq '1 day, 1 second' end end
Version data entries
6 entries across 6 versions & 1 rubygems