Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.48.mcz ==================== Summary ==================== Name: FFI-Tests-mt.48 Author: mt Time: 26 May 2021, 11:38:32.557346 am UUID: 3abd90ac-f78e-b542-9442-2942594cc738 Ancestors: FFI-Tests-mt.47 Complements FFI-Kernel-mt.169 (and FFI-Examples-mt.8). =============== Diff against FFI-Tests-mt.47 =============== Item was added: + ----- Method: FFIAllocateExternalTests>>test21ArrayAssureLocal (in category 'tests - array') ----- + test21ArrayAssureLocal + "Copy the array into local (object) memory." + + | original copy | + original := self allocate: ExternalType int32_t size: 5. + copy := original assureLocal. + self deny: original == copy. + self assert: copy assureLocal identical: copy.! Item was added: + ----- Method: FFIAllocateTests>>test20ArrayCopy (in category 'tests - array') ----- + test20ArrayCopy + "Copy the array into a new array." + + | original firstCopy secondCopy | + original := self allocate: ExternalType int32_t size: 5. + firstCopy := original copy. + secondCopy := firstCopy copy. + + firstCopy withIndexDo: [:num :index | firstCopy at: index put: index]. + self assert: #(0 0 0 0 0) equals: (original collect: #yourself). + self assert: #(1 2 3 4 5) equals: (firstCopy collect: #yourself). + self assert: #(0 0 0 0 0) equals: (secondCopy collect: #yourself). + + secondCopy withIndexDo: [:num :index | secondCopy at: index put: index+1]. + self assert: #(0 0 0 0 0) equals: (original collect: #yourself). + self assert: #(1 2 3 4 5) equals: (firstCopy collect: #yourself). + self assert: #(2 3 4 5 6) equals: (secondCopy collect: #yourself). + ! Item was added: + ----- Method: FFIAllocateTests>>test21ArrayAssureLocal (in category 'tests - array') ----- + test21ArrayAssureLocal + "Copy the array into local (object) memory." + + | original copy | + original := self allocate: ExternalType int32_t size: 5. + copy := original assureLocal. + self assert: original identical: copy.! Item was added: + ExternalStructure subclass: #X64TestStruct + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'FFI-Tests-Fixtures'! Item was added: + ----- Method: X64TestStruct class>>fields (in category 'field definition') ----- + fields + "X64TestStruct defineFields" + ^#( + (one 'longlong') + (two 'double') + (three 'longlong') + (four 'double') + (five 'longlong') + (six 'double') + (seven 'longlong') + (eight 'double') + (nine 'longlong') + (ten 'double') + (eleven 'longlong') + (twelve 'double') + (thirteen 'longlong') + (fourteen 'double') + (fifteen 'longlong') + (sixteen 'double') + )! Item was added: + ExternalStructure subclass: #X64TestStruct2 + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'FFI-Tests-Fixtures'! Item was added: + ----- Method: X64TestStruct2 class>>fields (in category 'field definition') ----- + fields + "X64TestStruct2 defineFields" + ^#( + (one #X64TestStruct) + (two #X64TestStruct) + )! Item was added: + ExternalStructure subclass: #X64TestStruct3 + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'FFI-Tests-Fixtures'! Item was added: + ----- Method: X64TestStruct3 class>>fields (in category 'field definition') ----- + fields + "X64TestStruct3 defineFields" + ^#( + (one 'longlong') + (two 'double') + (three 'longlong') + (four 'double') + (five 'longlong') + (six 'double') + (seven 'longlong') + (eight 'double') + (nine 'longlong') + (ten 'double') + (eleven 'longlong') + (twelve 'double') + (thirteen 'longlong') + (fourteen 'double') + (fifteen 'longlong') + (sixteen 'double') + (seventeen #X64TestStruct) + (eighteen #X64TestStruct2) + (nineteen 'X64TestStruct*') + (twenty 'X64TestStruct2*') + )! |
Free forum by Nabble | Edit this page |