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

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

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

Name: FFI-Tests-mt.42
Author: mt
Time: 17 May 2021, 10:04:14.48387 am
UUID: 7e88afc9-7a32-ee42-a024-591c91ea8b4a
Ancestors: FFI-Tests-mt.41

Complements FFI-Kernel-mt.157

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

Item was changed:
  ----- Method: ExternalTypeTests>>testArrayOfUnknown (in category 'tests - unkown types') -----
  testArrayOfUnknown
+ "For missing a referentClass, an unknown type will be constructed."
- "For missing referentClass, one can safely try to lookup an array type but forcing its creation will raise an error. Note that it is not possible to embed an array type for a struct in itself. You MUST use pointer types for that."
 
+ | type |
+ Smalltalk garbageCollect.
+ ExternalType cleanupUnusedTypes.
+
+ self assert: nil equals: (ExternalType typeNamed: 'UnknownStruct[]').
+ self assert: nil equals: (ExternalType typeNamed: 'UnknownStruct[5]').
+
+ type := ExternalType newTypeNamed: 'UnknownStruct[5]'.
+ self assert: type isArrayType.
+ self assert: type isUnknownType.
+
+ type := ExternalType newTypeNamed: 'UnknownStruct[]'.
+ self assert: type isArrayType.
+ self assert: type isUnknownType.
+
+ "Already there."
+ self should: [ExternalType newTypeNamed: 'UnknownStruct[]'] raise: Error.
+ self should: [ExternalType newTypeNamed: 'UnknownStruct[5]'] raise: Error.
+ !
- self
- assert: nil
- equals: (ExternalType typeNamed: 'UnknownStruct[5]').
-
- self
- should: [ExternalType newTypeNamed: 'UnknownStruct[5]']
- raise: Error.!

Item was changed:
  ----- Method: FFIAllocateTests>>test04ArrayCompositeAccess (in category 'tests - array') -----
  test04ArrayCompositeAccess
 
  | data |
  data := FFITestSdA5i allocate.
+ self assert: 0 equals: data a5i2 first.
- self assert: data a5i2 first equals: 0.
  data writer a5i2 at: 1 put: 42.
+ self assert: 42 equals: data a5i2 first.!
- self assert: data a5i2 first equals: 42.!