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

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

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

Name: FFI-Tests-mt.23
Author: mt
Time: 3 May 2021, 6:57:25.250479 pm
UUID: d282dcac-b99c-7a46-a154-b47378bca82a
Ancestors: FFI-Tests-mt.22

Complements FFI-Kernel-mt.126

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

Item was changed:
  TestCase subclass: #ExternalStructureTests
+ instanceVariableNames: 'heapObject'
- instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'FFI-Tests'!

Item was added:
+ ----- Method: ExternalStructureTests>>tearDown (in category 'running') -----
+ tearDown
+
+ heapObject ifNotNil: [heapObject free].!

Item was added:
+ ----- Method: ExternalStructureTests>>test04AccessingInternalMemory (in category 'tests') -----
+ test04AccessingInternalMemory
+ "Check whether we can use a ByteArrayWriter to fill structures."
+
+ | composite |
+ composite := FFITestSUfdUdSi2 new.
+
+ self assert: composite ~~ composite writer.
+
+ self assert: 0.0 equals: composite ufd1 f1.
+ composite ufd1 f1: 3.5.
+ self deny: 3.5 equals: composite ufd1 f1.
+ composite writer ufd1 f1: 3.5.
+ self assert: 3.5 equals: composite ufd1 f1.
+
+ self assert: 0 equals: composite udSii2 sii1 i1.
+ composite udSii2 sii1 i1: 42.
+ self deny: 42 equals: composite udSii2 sii1 i1.
+ composite writer udSii2 sii1 i1: 42.
+ self assert: 42 equals: composite udSii2 sii1 i1.!

Item was added:
+ ----- Method: ExternalStructureTests>>test05AccessingExternalMemory (in category 'tests') -----
+ test05AccessingExternalMemory
+ "Check whether we will stick to the ExternalAddress to fill structures."
+
+ | composite |
+ composite := heapObject := FFITestSUfdUdSi2 externalNew.
+ heapObject zeroMemory.
+
+ self assert: composite == composite writer.
+
+ self assert: 0.0 equals: composite ufd1 f1.
+ composite ufd1 f1: 3.5.
+ self assert: 3.5 equals: composite ufd1 f1.
+
+ self assert: 0 equals: composite udSii2 sii1 i1.
+ composite udSii2 sii1 i1: 42.
+ self assert: 42 equals: composite udSii2 sii1 i1.!

Item was added:
+ ----- Method: ExternalStructureTests>>test06AccessingTypeAliasForAtomic (in category 'tests') -----
+ test06AccessingTypeAliasForAtomic
+
+ | char |
+ self should: [FFITestCharAlias new] raise: Error.
+ char := FFITestCharAlias fromHandle: $C.
+ self assert: $C equals: char value.
+ char value: $A.
+ self assert: $A equals: char value.
+ char zeroMemory.
+ self assert: $0 equals: char value.!

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

Item was added:
+ ----- Method: FFITestCharAlias class>>originalTypeName (in category 'type alias') -----
+ originalTypeName
+
+ ^ 'char'!