FFI: FFI-Tests-mt.25.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.25.mcz

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

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

Name: FFI-Tests-mt.25
Author: mt
Time: 4 May 2021, 4:52:20.680881 pm
UUID: 7168c581-7b46-2243-bc64-c48a504ce87c
Ancestors: FFI-Tests-mt.24

More tests. Complements FFI-Kernel-mt.130

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

Item was added:
+ ----- Method: ExternalStructureTests>>test07AccessingArrays (in category 'tests') -----
+ test07AccessingArrays
+
+ | data |
+ data := FFITestSdA5i new.
+ self assert: data a5i2 first equals: 0.
+ data writer a5i2 at: 1 put: 42.
+ self assert: data a5i2 first equals: 42.
+
+ data := heapObject := FFITestSdA5i externalNew.
+ data zeroMemory.
+ self assert: data a5i2 first equals: 0.
+ data a5i2 at: 1 put: 42.
+ self assert: data a5i2 first equals: 42.!

Item was added:
+ ----- Method: FFITestLibrary class>>ffiTestArrayType (in category 'mocks') -----
+ ffiTestArrayType
+
+ <cdecl: char[] 'ffiTestArrayType' (float[5] FFITestPoint2[10] int[0]) module: 'SqueakFFIPrims'>
+ ^ self externalCallFailed !

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

Item was added:
+ ----- Method: FFITestSdA5i class>>fields (in category 'as yet unclassified') -----
+ fields
+ "
+ FFITestSdA5i defineFields
+ "
+ ^ #(
+ (d1 'double')
+ (a5i2 'int32_t[5]')
+ )!

Item was added:
+ ----- Method: FFITypeNameTests>>testArray (in category 'tests') -----
+ testArray
+
+ (self argTypesAt: #ffiTestArrayType) do: [:type |
+ self
+ assert: type isPointerType;
+ deny: type isArrayType;
+ assert: type asNonPointerType isArrayType;
+ assert: type asNonPointerType size >= 0]!