* ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):
return the result of a block. * test/bigdecimal/test_bigdecimal.rb (test_save_rounding_mode): add a test for the above change. * test/bigdecimal/test_bigdecimal.rb (test_save_exception_mode): add a test for the return value of BigDecimal.save_exception_mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
98d7c2b8f1
commit
fed832d7f2
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Wed Sep 29 13:26:30 2010 Kenta Murata <mrkn@mrkn.jp>
|
||||||
|
|
||||||
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_save_rounding_mode):
|
||||||
|
return the result of a block.
|
||||||
|
|
||||||
|
* test/bigdecimal/test_bigdecimal.rb (test_save_rounding_mode):
|
||||||
|
add a test for the above change.
|
||||||
|
|
||||||
|
* test/bigdecimal/test_bigdecimal.rb (test_save_exception_mode):
|
||||||
|
add a test for the return value of BigDecimal.save_exception_mode.
|
||||||
|
|
||||||
Wed Sep 29 12:45:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Sep 29 12:45:30 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,
|
* ext/bigdecimal/bigdecimal.c (BigDecimal_div2, BigDecimal_add2,
|
||||||
|
@ -1864,7 +1864,7 @@ BigDecimal_save_rounding_mode(VALUE self)
|
|||||||
VALUE ret = rb_protect(rb_yield, Qnil, &state);
|
VALUE ret = rb_protect(rb_yield, Qnil, &state);
|
||||||
VpSetRoundMode(round_mode);
|
VpSetRoundMode(round_mode);
|
||||||
if (state) rb_jump_tag(state);
|
if (state) rb_jump_tag(state);
|
||||||
return Qnil;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* call-seq:
|
/* call-seq:
|
||||||
|
@ -112,6 +112,8 @@ class TestBigDecimal < Test::Unit::TestCase
|
|||||||
BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
|
BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
|
||||||
end
|
end
|
||||||
assert_equal(BigDecimal::ROUND_HALF_EVEN, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
assert_equal(BigDecimal::ROUND_HALF_EVEN, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
||||||
|
|
||||||
|
assert_equal(42, BigDecimal.save_exception_mode { 42 })
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_save_rounding_mode
|
def test_save_rounding_mode
|
||||||
@ -120,6 +122,8 @@ class TestBigDecimal < Test::Unit::TestCase
|
|||||||
BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
|
BigDecimal.mode(BigDecimal::ROUND_MODE, BigDecimal::ROUND_HALF_EVEN)
|
||||||
end
|
end
|
||||||
assert_equal(BigDecimal::ROUND_FLOOR, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
assert_equal(BigDecimal::ROUND_FLOOR, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
||||||
|
|
||||||
|
assert_equal(42, BigDecimal.save_rounding_mode { 42 })
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_save_limit
|
def test_save_limit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user