Sha256: f9c4e66b510e24375b0a5ba0195d28777860158edb72585903b3c760a25c45e5

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 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

end







Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_numeric_round-1.0.0 test/sixarm_ruby_numeric_round_test.rb