From 143fbdf8692e2ba5145013030045a97401ca3437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 14 May 2014 16:25:37 +0200 Subject: [PATCH] [BigDecimal] Add tests for NSDecimalNumber -> NSDecimal. --- test/test/spec/nsdecimal_spec.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/test/spec/nsdecimal_spec.rb b/test/test/spec/nsdecimal_spec.rb index 6913d15a..4cf16208 100644 --- a/test/test/spec/nsdecimal_spec.rb +++ b/test/test/spec/nsdecimal_spec.rb @@ -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