Sha256: eb12452bf3a253a63559a9f05876fe49e97ebd0d7ff1001c6ffa215549d322f0
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
# -*- coding: utf-8 -*- require "minitest/autorun" require "simplecov" SimpleCov.start require "sixarm_ruby_numeric_round" describe Float do describe "#ceil_at" do it "works" do 4.555.ceil_at(0).must_equal 5.0 4.555.ceil_at(1).must_equal 4.6 4.555.ceil_at(2).must_equal 4.56 4.555.ceil_at(3).must_equal 4.555 end end describe "#ceil_to" do it "works" do 4.555.ceil_to(1).must_equal 5.0 4.555.ceil_to(0.1).must_equal 4.6 4.555.ceil_to(0.01).must_equal 4.56 4.555.ceil_to(0).must_equal 4.555 end end describe "#floor_at" do it "works" do 4.555.floor_at(0).must_equal 4.0 4.555.floor_at(1).must_equal 4.5 4.555.floor_at(2).must_equal 4.55 4.555.floor_at(3).must_equal 4.555 end end describe "#floor_to" do it "works" do 4.555.floor_to(1).must_equal 4.0 4.555.floor_to(0.1).must_equal 4.5 4.555.floor_to(0.01).must_equal 4.55 4.555.floor_to(0).must_equal 4.555 end end describe "#round_at" do it "works" do 4.555.round_at(0).must_equal 5.0 4.555.round_at(1).must_equal 4.6 4.555.round_at(2).must_equal 4.56 4.555.round_at(3).must_equal 4.555 end end describe "#round_to" do it "works" do 4.555.round_to(1).must_equal 5 4.555.round_to(0.1).must_equal 4.6 4.555.round_to(0.01).must_equal 4.56 4.555.round_to(0).must_equal 4.555 end end describe "#truncate_at" do it "works" do 4.555.truncate_at(0).must_equal 4.0 4.555.truncate_at(1).must_equal 4.5 4.555.truncate_at(2).must_equal 4.55 4.555.truncate_at(3).must_equal 4.555 end end describe "#truncate_to" do it "works" do 4.555.truncate_to(1).must_equal 4.0 4.555.truncate_to(0.1).must_equal 4.5 4.555.truncate_to(0.01).must_equal 4.55 4.555.truncate_to(0).must_equal 4.555 end end end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sixarm_ruby_numeric_round-1.0.4 | test/sixarm_ruby_numeric_round_test/float_test.rb |
sixarm_ruby_numeric_round-1.0.4 | test/sixarm_ruby_numeric_round_test/numeric_test.rb |