This repository has been archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
TFUFFIBasicTypeMarshallingInCallbacksTest.class.st
122 lines (86 loc) · 2.65 KB
/
TFUFFIBasicTypeMarshallingInCallbacksTest.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Class {
#name : #TFUFFIBasicTypeMarshallingInCallbacksTest,
#superclass : #TFUFFIMarshallingInCallbacksTest,
#category : #'ThreadedFFI-UFFI-Tests'
}
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testChar [
self assertCharType: 'char'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testDouble [
| received |
received := self call: 'double' value: 2.7.
self assert: received equals: 2.7
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testFloat [
| received |
received := self call: 'float' value: 2.7.
self assert: (received between: 2.6999 and: 2.7001)
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testPointer [
| bytes received |
[
bytes := ExternalAddress allocate: 2 "bytes".
received := self call: 'pointer' type: #(void* name) value: bytes.
self assert: received getHandle equals: bytes getHandle
] ensure: [ bytes free ]
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedInt [
self assertSignedIntType: 'int'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedInt16 [
self assertSignedIntType: 'int16'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedInt32 [
self assertSignedIntType: 'int32'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedInt64 [
self assertSignedIntType: 'int64'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedInt8 [
self assertSignedIntType: 'int8'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedLong [
self assertSignedIntType: 'long'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testSignedShort [
self assertSignedIntType: 'short'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedInt [
self assertUnsignedIntType: 'uint'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedInt16 [
self assertUnsignedIntType: 'uint16'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedInt32 [
self assertUnsignedIntType: 'uint32'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedInt64 [
self assertUnsignedIntType: 'uint64'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedInt8 [
self assertUnsignedIntType: 'uint8'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedLong [
self assertUnsignedIntType: 'ulong'
]
{ #category : #tests }
TFUFFIBasicTypeMarshallingInCallbacksTest >> testUnsignedShort [
self assertUnsignedIntType: 'ushort'
]