Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.37.mcz ==================== Summary ==================== Name: FFI-Tests-mt.37 Author: mt Time: 16 May 2021, 7:30:08.986024 am UUID: 461435c5-e0ab-904d-9e43-b1b02fbe51a8 Ancestors: FFI-Tests-mt.36 Complements FFI-Kernel-mt.150 =============== Diff against FFI-Tests-mt.36 =============== Item was changed: ----- Method: FFIAllocateExternalTests>>checkAllocate: (in category 'running') ----- checkAllocate: externalObject | type handle | self assert: externalObject notNil. (externalObject isExternalObject) ifFalse: [ externalObjects remove: externalObject. "skip free" ^ self "atomics are fine"]. type := externalObject externalType. handle := externalObject getHandle. + (type isAtomic and: [type isVoid not]) ifTrue: [ - type isAtomic ifTrue: [ self deny: handle isExternalAddress. self deny: handle isInternalMemory. self deny: handle isNil. ^ self]. self deny: externalObject isNull. self deny: handle isNull. self deny: handle isNil. self assert: type isPointerType. self assert: handle isExternalAddress. self deny: handle isInternalMemory.! Item was changed: ----- Method: FFIAllocateTests>>checkAllocate: (in category 'running') ----- checkAllocate: externalObject | type handle | self assert: externalObject notNil. (externalObject isExternalObject) ifFalse: [ externalObjects remove: externalObject. "skip free" ^ self "pure atomics are fine"]. type := externalObject externalType. handle := externalObject getHandle. + (type isAtomic and: [type isVoid not]) ifTrue: [ - type isAtomic ifTrue: [ self deny: handle isExternalAddress. self deny: handle isInternalMemory. self deny: handle isNil. ^ self]. self deny: externalObject isNull. self deny: handle isNull. self deny: handle isNil. self deny: type isPointerType. self deny: handle isExternalAddress. self assert: handle isInternalMemory.! Item was added: + ----- Method: FFIAllocateTests>>test11ArrayAsVoidPointer (in category 'tests - array') ----- + test11ArrayAsVoidPointer + "Check whether the undefined content type -- void -- works. Type casting via #setContentType: is necessary in such cases." + + | type void array | + type := ExternalType int32_t. + void := ExternalType void. + array := self allocate: type size: 5. + self assert: type equals: array contentType. + array setContentType: void. + self checkAllocate: array. "Checks container type." + self assert: void equals: array contentType. + self assert: array size isNil. + self should: [array at: 1] raise: Error. + self should: [array at: 1 put: 42] raise: Error. + array setContentType: type. + self checkAllocate: array. + self assert: type equals: array contentType. + self assert: array size isNil. + self shouldnt: [array at: 1] raise: Error. + self shouldnt: [array at: 1 put: 42] raise: Error. ! |
Free forum by Nabble | Edit this page |