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

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

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

Name: FFI-Tests-mt.26
Author: mt
Time: 5 May 2021, 6:07:51.408784 pm
UUID: 591e208f-d61f-dc4e-a9d0-80bb2279824a
Ancestors: FFI-Tests-mt.25

More tests :-)

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

Item was added:
+ ----- Method: ExternalStructureTests>>test01CopyStructure (in category 'tests - external structure') -----
+ test01CopyStructure
+
+ | original copy |
+ original := FFITestPoint2 new.
+ original setX: 1 setY: 2.
+
+ copy := original copy.
+ self assert: original getHandle ~~ copy getHandle.
+
+ copy setX: 3 setY: 4.
+ self assert: 1@2 equals: original asPoint.
+ self assert: 3@4 equals: copy asPoint.!

Item was added:
+ ----- Method: ExternalStructureTests>>test02CopyStructureFromExternal (in category 'tests - external structure') -----
+ test02CopyStructureFromExternal
+
+ | original copy |
+ original := heapObject := FFITestPoint2 externalNew.
+ original setX: 1 setY: 2.
+
+ copy := original copy.
+ self assert: copy getHandle isInternalMemory.
+
+ copy setX: 3 setY: 4.
+ self assert: 1@2 equals: original asPoint.
+ self assert: 3@4 equals: copy asPoint.!

Item was added:
+ ----- Method: ExternalTypeTests>>testArrayTypesForAtomics (in category 'tests') -----
+ testArrayTypesForAtomics
+
+ self
+ should: [ExternalType void asArrayType: 5]
+ raise: Error.
+
+ AtomicTypeNames keysInOrder allButFirst "void" do: [:index |
+ | atomicType arrayType |
+ atomicType := AtomicTypes at: (AtomicTypeNames at: index).
+ arrayType := atomicType asArrayType: 5.
+ self assert: arrayType isArrayType.
+ self assert: arrayType isAtomic.
+ self deny: arrayType isStructureType.
+ self deny: arrayType isPointerType.
+ self assert: 5 equals: arrayType size].!

Item was added:
+ ----- Method: ExternalTypeTests>>testArrayTypesForStructs (in category 'tests') -----
+ testArrayTypesForStructs
+
+ {
+ FFITestPoint2.
+ FFITestSdi.
+ FFITestUfd.
+ FFITestIntAlias.
+ FFITestCompoundStruct.
+ } do: [:structClass |
+ | arrayType |
+ arrayType := structClass externalType asArrayType: 5.
+ self assert: arrayType isArrayType.
+ self deny: arrayType isPointerType.
+ self assert: 5 equals: arrayType size].!

Item was changed:
  ----- Method: FFITestIntAlias class>>originalTypeName (in category 'type alias') -----
  originalTypeName
+ "
+ self defineFields
+ "
+ ^ 'int32_t'!
-
- ^ 'int'!