[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[S8Ref] address

"address - basic"
| buffer |
buffer := NodeBuffer string: #hello.
(S8Ref current address: buffer) > 0 ifFalse: [
	^self print: 'Address must be positive'
].


"address - offsets"
| buffer address |
buffer := NodeBuffer string: #hello. 
address := S8Ref current address: buffer.
(1 to: 10) detect: [:i|
	address + i ~= (S8Ref current address: buffer offset: i)
] ifNone: [ ^#ok ].
^self error: 'Invalid address offset'


"address - negative offsets"
| buffer address |
buffer := NodeBuffer string: #hello. 
address := S8Ref current address: buffer.
(1 to: 10) detect: [:i|
	address - i ~= (S8Ref current address: buffer offset: i negated)
] ifNone: [ ^#ok ].
^self error: 'Invalid address offset'


"address - zero offset"
| buffer address |
buffer := NodeBuffer string: #hello. 
address := S8Ref current address: buffer.
address ~= (S8Ref current address: buffer offset: 0) ifTrue: [
	^self error: 'Invalid address offset'
]