mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-04-01 17:39:54 +08:00
add Struct spec for converting Fixnum/Float to Objective-C value
Relate to 01311e1f88
This commit is contained in:
@@ -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
|
||||
8
test/test/vendor/code/code.h
vendored
8
test/test/vendor/code/code.h
vendored
@@ -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
2
vm
Submodule vm updated: 9d8885ec39...01311e1f88
Reference in New Issue
Block a user