-
Notifications
You must be signed in to change notification settings - Fork 67
/
VMFFIHelpersTest.class.st
167 lines (108 loc) · 5.87 KB
/
VMFFIHelpersTest.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Class {
#name : #VMFFIHelpersTest,
#superclass : #VMAbstractFFITest,
#category : #VMMakerTests
}
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> assertPopInEmptyStackFails [
[ interpreter popSameThreadCalloutSuspendedProcess.
self fail ]
onErrorDo: [ :anError |
self
assert: anError messageText
equals: 'SameThreadCalloutSuspendedProcessStack is empty' ]
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPopSameThreadCalloutSuspendedProcessInEmptyStackRaisesError [
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
self assertPopInEmptyStackFails
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushPushThenPopPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsFirstPushedProcess [
| aProcess anotherProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
anotherProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
interpreter pushSameThreadCalloutSuspendedProcess: anotherProcess.
interpreter popSameThreadCalloutSuspendedProcess.
self assert: interpreter popSameThreadCalloutSuspendedProcess equals: aProcess.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushPushThenPopPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsFirstPushedProcessWithNilNextLink [
| aProcess anotherProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
anotherProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
interpreter pushSameThreadCalloutSuspendedProcess: anotherProcess.
interpreter popSameThreadCalloutSuspendedProcess.
self assert: (memory fetchPointer: NextLinkIndex ofObject: interpreter popSameThreadCalloutSuspendedProcess) equals: memory nilObject.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushPushThenPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsLastPushedProcess [
| aProcess anotherProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
anotherProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
interpreter pushSameThreadCalloutSuspendedProcess: anotherProcess.
self assert: interpreter popSameThreadCalloutSuspendedProcess equals: anotherProcess.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushPushThenPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsLastPushedProcessWithNilNextLink [
| aProcess anotherProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
anotherProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
interpreter pushSameThreadCalloutSuspendedProcess: anotherProcess.
self assert: (memory fetchPointer: NextLinkIndex ofObject: interpreter popSameThreadCalloutSuspendedProcess) equals: memory nilObject.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushSameThreadCalloutSuspendedProcessInEmptyStackStoresThePassedProcess [
| aProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createProcessFor: memory nilObject priority: 2.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
self assert: (memory splObj: SuspendedProcessInCallout) equals: aProcess.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushSameThreadCalloutSuspendedProcessInEmptyStackUpdatesNextLinkWithNil [
| aProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
self assert: (memory fetchPointer: NextLinkIndex ofObject: aProcess) equals: memory nilObject.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushThenPopPopSameThreadCalloutSuspendedProcessInEmptyStackFails [
| aProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
interpreter popSameThreadCalloutSuspendedProcess.
self assertPopInEmptyStackFails
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushThenPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsProcessWithNilInNextLink [
| aProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
self assert: (memory fetchPointer: NextLinkIndex ofObject: aProcess) equals: memory nilObject.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testPushThenPopSameThreadCalloutSuspendedProcessInEmptyStackReturnsPushedProcess [
| aProcess |
self assert: (memory splObj: SuspendedProcessInCallout) equals: memory nilObject.
aProcess := self createSuspendedProcessFor: memory nilObject priority: 1.
interpreter pushSameThreadCalloutSuspendedProcess: aProcess.
self assert: interpreter popSameThreadCalloutSuspendedProcess equals: aProcess.
]
{ #category : #'tests - helpers' }
VMFFIHelpersTest >> testReadAddressReadsTheValidAddressValue [
| anExternalAddress |
anExternalAddress := self newExternalAddress: 4.
self assert: (interpreter readAddress: anExternalAddress) equals: 4
]