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

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

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

Name: FFI-Tests-mt.27
Author: mt
Time: 5 May 2021, 6:23:00.940784 pm
UUID: c4413cf7-61cb-8f49-bac0-82bb8eb8650c
Ancestors: FFI-Tests-mt.26

Complements FFI-Kernel-mt.133

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

Item was added:
+ ----- Method: ExternalTypeTests>>testArrayTypesEmpty (in category 'tests') -----
+ testArrayTypesEmpty
+
+ self
+ should: [ExternalType char asArrayType: 0]
+ raise: Error;
+ should: [ExternalType typeNamed: 'char[]']
+ raise: Error;
+ should: [ExternalType typeNamed: 'char[0]']
+ raise: Error.!

Item was changed:
  ----- Method: ExternalTypeTests>>testArrayTypesForStructs (in category 'tests') -----
  testArrayTypesForStructs
 
+ self assert: (ExternalType typeNamed: 'UnknownStruct[5]') isNil.
+ self
+ should: [ExternalType newTypeNamed: 'UnknownStruct[5]']
+ raise: Error.
  {
  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: FFITestLibrary class>>ffiTestArrayType (in category 'mocks') -----
  ffiTestArrayType
+ "Just a mock. Not sure whether there will ever be call signatures using array types ... isn't this pass-by-pointer anyway?"
+
+ <cdecl: char[5] 'ffiTestArrayType' (float[5] FFITestPoint2[10] int[1]) module: 'SqueakFFIPrims'>
-
- <cdecl: char[] 'ffiTestArrayType' (float[5] FFITestPoint2[10] int[0]) module: 'SqueakFFIPrims'>
  ^ self externalCallFailed !

Item was changed:
  ----- 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]!
- assert: type asNonPointerType size >= 0]!