Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.52.mcz ==================== Summary ==================== Name: FFI-Tests-mt.52 Author: mt Time: 8 June 2021, 11:54:40.903752 am UUID: a366270d-4f7e-d447-913e-2c38fd1f2c47 Ancestors: FFI-Tests-mt.51 Complements FFI-Kernel-mt.181 =============== Diff against FFI-Tests-mt.51 =============== Item was changed: ----- Method: ExternalTypeTests>>testArrayOfAliases (in category 'tests - array types') ----- testArrayOfAliases self classesForTypeAliases do: [:aliasClass | | contentType arrayType | contentType := aliasClass externalType. arrayType := contentType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self assert: contentType identical: arrayType contentType; assert: contentType byteAlignment equals: arrayType byteAlignment. self assert: contentType isTypeAlias; assert: (contentType isAtomic or: [contentType isStructureType]); deny: contentType isPointerType; deny: contentType isArrayType. self deny: arrayType isAtomic; deny: arrayType isStructureType; deny: arrayType isPointerType; deny: arrayType isTypeAlias. self + deny: contentType referentClass isNil; + assert: arrayType referentClass isNil].! - "referentClass shared" - assert: contentType referentClass - identical: arrayType referentClass].! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfAliasesForArrays (in category 'tests - array types') ----- testArrayOfAliasesForArrays "This is the only way to construct n-dimensional arrays for now." | contentType arrayType | contentType := FFITestAliasForInt32Array externalType. arrayType := contentType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self assert: contentType identical: arrayType contentType; assert: contentType byteAlignment equals: arrayType byteAlignment. self assert: contentType isTypeAlias; assert: contentType isArrayType; deny: contentType isAtomic; deny: contentType isStructureType; deny: contentType isPointerType. self deny: arrayType isAtomic; deny: arrayType isStructureType; deny: arrayType isPointerType; deny: arrayType isTypeAlias. self + deny: contentType referentClass isNil; + assert: arrayType referentClass isNil.! - "referentClass shared" - assert: contentType referentClass - identical: arrayType referentClass.! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfAliasesForPointers (in category 'tests - array types') ----- testArrayOfAliasesForPointers self specsForTypeAliasForPointer groupsDo: [:aliasClass :originalType | | contentType arrayType | contentType := aliasClass externalType. arrayType := contentType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self assert: contentType identical: arrayType contentType; assert: contentType byteAlignment equals: arrayType byteAlignment. self assert: contentType isTypeAlias; assert: contentType isPointerType; deny: contentType isAtomic; deny: contentType isStructureType; deny: contentType isArrayType. self deny: arrayType isAtomic; deny: arrayType isStructureType; deny: arrayType isPointerType; deny: arrayType isTypeAlias. self + deny: contentType referentClass isNil; + assert: arrayType referentClass isNil].! - "referentClass shared" - assert: contentType referentClass - identical: arrayType referentClass].! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfAliasesForPointersDereferenced (in category 'tests - array types') ----- testArrayOfAliasesForPointersDereferenced "It should be possible to use the non-pointer type of an alias-to-pointer type as contentType in an array/container." self specsForTypeAliasForPointer groupsDo: [:aliasClass :originalType | | contentType arrayType | contentType := aliasClass externalType asNonPointerType. contentType byteSize = 0 ifTrue: [^ self "Ignore void"]. arrayType := contentType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self assert: contentType identical: arrayType contentType; assert: contentType byteAlignment equals: arrayType byteAlignment. self deny: contentType isTypeAlias; deny: contentType isPointerType; assert: [contentType isAtomic or: [contentType isStructureType or: [contentType isArrayType]]]. self deny: arrayType isAtomic; deny: arrayType isStructureType; deny: arrayType isPointerType; deny: arrayType isTypeAlias. self + deny: contentType referentClass isNil; + assert: arrayType referentClass isNil].! - "referentClass shared" - assert: contentType referentClass - identical: arrayType referentClass].! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfPointersToStructs (in category 'tests - array types') ----- testArrayOfPointersToStructs self classesForStructures do: [:structClass | | arrayType contentType | contentType := structClass externalType asPointerType. arrayType := contentType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self deny: arrayType isAtomic. self deny: arrayType isStructureType. self deny: arrayType isPointerType. self deny: arrayType isTypeAlias. + self assert: arrayType referentClass isNil].! - self - assert: structClass - identical: arrayType referentClass].! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfStructs (in category 'tests - array types') ----- testArrayOfStructs self classesForStructures do: [:structClass | | arrayType contentType | contentType := structClass externalType. arrayType := structClass externalType asArrayType: 5. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self assert: 5 * contentType byteSize equals: arrayType byteSize. self deny: arrayType isAtomic. self deny: arrayType isStructureType. self deny: arrayType isPointerType. self deny: arrayType isTypeAlias. + self assert: arrayType referentClass isNil].! - self - assert: structClass - identical: arrayType referentClass].! Item was changed: ----- Method: ExternalTypeTests>>testArrayOfStructsEmpty (in category 'tests - array types') ----- testArrayOfStructsEmpty | structClass arrayType contentType | structClass := FFITestEmptyStruct. contentType := structClass externalType. arrayType := structClass externalType asArrayType: 5. self assert: contentType isEmpty. self assert: 0 equals: contentType byteSize. self assert: 0 equals: arrayType byteSize. self assert: arrayType isArrayType. self assert: contentType identical: arrayType contentType. self assert: 5 equals: arrayType size. self deny: arrayType isAtomic. self deny: arrayType isStructureType. self deny: arrayType isPointerType. self deny: arrayType isTypeAlias. + self assert: arrayType referentClass isNil.! - self - assert: structClass - identical: arrayType referentClass.! Item was changed: ----- Method: ExternalTypeTests>>testPointerToAliasForArray (in category 'tests - pointer types') ----- testPointerToAliasForArray | type pointerType | type := FFITestAliasForInt32Array externalType. pointerType := type asPointerType. self assert: type isArrayType; assert: type isTypeAlias. self assert: pointerType isPointerType; - assert: pointerType isPointerTypeForArray; deny: pointerType isAtomic; deny: pointerType isStructureType; deny: pointerType isArrayType; deny: pointerType isTypeAlias. + self assert: pointerType referentClass notNil.! - self - "referentClass is nil to ensure ExternalData for return values from FFI calls" - assert: pointerType referentClass isNil.! |
Free forum by Nabble | Edit this page |