FFI: FFI-Tests-mt.31.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI: FFI-Tests-mt.31.mcz

commits-2
Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.31.mcz

==================== Summary ====================

Name: FFI-Tests-mt.31
Author: mt
Time: 8 May 2021, 7:58:33.518404 pm
UUID: 7593fdcc-becc-bc4c-99f6-2387234347c2
Ancestors: FFI-Tests-mt.30

Adds test for a linked list in external memory.

=============== Diff against FFI-Tests-mt.30 ===============

Item was added:
+ ----- Method: ExternalStructureTests>>test03LinkedList (in category 'tests - external structure') -----
+ test03LinkedList
+
+ | link1 link2 link3 |
+ [ link1 := FFITestLink allocateExternal.
+ link2 := FFITestLink allocateExternal.
+ link3 := FFITestLink allocateExternal.
+ link1 next: link2. link2 prev: link1.
+ link2 next: link3. link3 prev: link2.
+ link3 next: link1. link1 prev: link3.
+ self assert: link1 next = link2.
+ self assert: link2 next = link3.
+ self assert: link3 next = link1.
+
+ self assert: link3 prev = link2.
+ self assert: link2 prev = link1.
+ self assert: link1 prev = link3.
+
+ ] ensure: [
+ link1 free.
+ link2 free.
+ link3 free.
+ ]!

Item was added:
+ ExternalStructure subclass: #FFITestLink
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'FFI-Tests-Fixtures'!

Item was added:
+ ----- Method: FFITestLink class>>fields (in category 'field definition') -----
+ fields
+ "
+ self defineFields.
+ "
+ ^ #(
+ (prev 'FFITestLink*')
+ (next 'FFITestLink*')
+ )!

Item was added:
+ ----- Method: FFITestLink>>= (in category 'comparing') -----
+ = other
+
+ (other isKindOf: ExternalStructure) ifFalse: [^ false].
+ self externalType = other externalType ifFalse: [^ false].
+ ^ other getHandle = self getHandle!

Item was added:
+ ----- Method: FFITestLink>>hash (in category 'comparing') -----
+ hash
+
+ ^ ExternalObject hash bitXor: self getHandle hash!