Change soft-fail to use the config, rather than env
[rbx.git] / spec / frozen / 1.8 / library / bigdecimal / frac_spec.rb
blob5cb2f9cf44a00b76db603339f619de6922066253
1 require File.dirname(__FILE__) + '/../../spec_helper'
2 require 'bigdecimal'
4 describe "BigDecimal#frac" do
5   before(:each) do
6     @zero = BigDecimal("0")
7     @mixed = BigDecimal("1.23456789")
8     @pos_int = BigDecimal("2E5555")
9     @neg_int = BigDecimal("-2E5555")
10     @pos_frac = BigDecimal("2E-9999")
11     @neg_frac = BigDecimal("-2E-9999")
13     @infinity = BigDecimal("Infinity")
14     @infinity_neg = BigDecimal("-Infinity")
15     @nan = BigDecimal("NaN")
16     @zero_pos = BigDecimal("+0")
17     @zero_neg = BigDecimal("-0")
18   end
20   it "returns a BigDecimal" do
21     @pos_int.frac.kind_of?(BigDecimal).should == true
22     @neg_int.frac.kind_of?(BigDecimal).should == true
23     @pos_frac.kind_of?(BigDecimal).should == true
24     @neg_frac.kind_of?(BigDecimal).should == true
25   end
27   it "returns the fractional part of the absolute value" do
28     @mixed.frac.should == BigDecimal("0.23456789")
29     @pos_frac.frac.should == @pos_frac
30     @neg_frac.frac.should == @neg_frac
31   end
33   it "returns 0 if the value is 0" do
34     @zero.frac.should == @zero
35   end
37   it "returns 0 if the value is an integer" do
38     @pos_int.frac.should == @zero
39     @neg_int.frac.should == @zero
40   end
42   it "correctly handles special values" do
43     @infinity.frac.should == @infinity
44     @infinity_neg.frac.should == @infinity_neg
45     @nan.frac.nan?.should == true
46   end
48 end