mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-05-19 12:22:27 +08:00
[BigDecimal] Add tests for NSDecimalNumber -> NSDecimal.
This commit is contained in:
@@ -166,7 +166,7 @@ describe 'BigDecimal' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'concerning Objective-C interoperability' do
|
||||
describe 'concerning (Objective-)C interoperability' do
|
||||
it 'can be passed to Objective-C APIs transperantly' do
|
||||
string = '0.123456789123456789'
|
||||
formatter = NSNumberFormatter.new
|
||||
@@ -188,5 +188,16 @@ describe 'BigDecimal' do
|
||||
value.class.should == BigDecimal
|
||||
value.inspect.should == string
|
||||
end
|
||||
|
||||
it 'converts BigDecimal to NSDecimal' do
|
||||
string = '0.123456789123456789'
|
||||
number = NSDecimalNumber.decimalNumberWithDecimal(BigDecimal.new(string))
|
||||
number.description.should == string
|
||||
end
|
||||
|
||||
it 'converts BigDecimal to a pointer to NSDecimal' do
|
||||
string = '0.123456789123456789'
|
||||
NSDecimalString(BigDecimal.new(string), NSLocale.currentLocale).should == string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user