add Struct spec for converting Fixnum/Float to Objective-C value

Relate to 01311e1f88
This commit is contained in:
Watson
2013-11-14 17:31:07 +09:00
parent db916707c5
commit afce21ffad
3 changed files with 40 additions and 1 deletions

View File

@@ -19,3 +19,34 @@
# lambda { Struct.new(*fields) }.should.raise(ArgumentError)
# end
# end
describe "Struct" do
it "values are stored depending on the member type" do
struct = MyStructTestConvert.new
struct.m_long = 123
struct.m_long.should == 123
struct.m_long = 123.0
struct.m_long.should == 123
struct.m_ulong = 123
struct.m_ulong.should == 123
struct.m_ulong = 123.0
struct.m_ulong.should == 123
struct.m_longlong = 123
struct.m_longlong.should == 123
struct.m_longlong = 123.0
struct.m_longlong.should == 123
struct.m_ulonglong = 123
struct.m_ulonglong.should == 123
struct.m_ulonglong = 123.0
struct.m_ulonglong.should == 123
struct.m_double = 123
struct.m_double.should == 123.0
struct.m_double = 123.0
struct.m_double.should == 123.0
end
end

View File

@@ -1,5 +1,13 @@
#import <UIKit/UIKit.h>
struct MyStructTestConvert {
long m_long;
unsigned long m_ulong;
long long m_longlong;
unsigned long long m_ulonglong;
double m_double;
};
struct MyStruct4C {
char a, b, c, d;
};

2
vm

Submodule vm updated: 9d8885ec39...01311e1f88