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

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

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

Name: FFI-Tests-mt.46
Author: mt
Time: 21 May 2021, 11:54:32.525285 am
UUID: a5f60e40-93a8-ae44-a9de-0ea146302ac1
Ancestors: FFI-Tests-mt.45

Tests for FFI-Kernel-mt.165.

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

Item was added:
+ ----- Method: FFIAllocateTests>>test01ByHandleInt32Access (in category 'tests - array by handle') -----
+ test01ByHandleInt32Access
+
+ | type handle |
+ type := ExternalType int32_t.
+ handle := (self allocate: type size: 5) getHandle.
+ self assert: 0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 42.
+ type handle: handle atIndex: 1 put: 0.
+ self assert: 42 equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test02ByHandleFloatAccess (in category 'tests - array by handle') -----
+ test02ByHandleFloatAccess
+
+ | type handle |
+ type := ExternalType float.
+ handle := (self allocate: type size: 5) getHandle.
+ self assert: 0.0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 1.23.
+ type handle: handle atIndex: 1 put: 0.0.
+ self assert: ((type handle: handle atIndex: 2)
+ between: 1.23 - 0.0005 and: 1.23 + 0.0005).!

Item was added:
+ ----- Method: FFIAllocateTests>>test03ByHandleDoubleAccess (in category 'tests - array by handle') -----
+ test03ByHandleDoubleAccess
+
+ | type handle |
+ type := ExternalType double.
+ handle := (self allocate: type size: 5) getHandle.
+ self assert: 0.0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 1.23456.
+ type handle: handle atIndex: 1 put: 0.0.
+ self assert: 1.23456 equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test04ByHandleCharAccess (in category 'tests - array by handle') -----
+ test04ByHandleCharAccess
+
+ | type handle |
+ type := ExternalType char.
+ handle := (self allocate: type size: 5) getHandle.
+ self assert: Character null equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: $A.
+ type handle: handle atIndex: 1 put: Character null.
+ self assert: $A equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test05ByHandleBoolAccess (in category 'tests - array by handle') -----
+ test05ByHandleBoolAccess
+
+ | type handle |
+ type := ExternalType bool.
+ handle := (self allocate: type size: 5) getHandle.
+ self assert: false equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: true.
+ type handle: handle atIndex: 1 put: false.
+ self assert: true equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test06ByArrayHandleInt32Access (in category 'tests - array by handle') -----
+ test06ByArrayHandleInt32Access
+
+ | type handle |
+ type := ExternalType int32_t.
+ ExternalType useArrayClassesDuring: [
+ handle := (self allocate: type size: 5) getHandle].
+ self assert: 0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 42.
+ type handle: handle atIndex: 1 put: 0.
+ self assert: 42 equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test07ByArrayHandleFloatAccess (in category 'tests - array by handle') -----
+ test07ByArrayHandleFloatAccess
+
+ | type handle |
+ type := ExternalType float.
+ ExternalType useArrayClassesDuring: [
+ handle := (self allocate: type size: 5) getHandle].
+ self assert: 0.0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 1.23.
+ type handle: handle atIndex: 1 put: 0.0.
+ self assert: ((type handle: handle atIndex: 2)
+ between: 1.23 - 0.0005 and: 1.23 + 0.0005).!

Item was added:
+ ----- Method: FFIAllocateTests>>test08ByArrayHandleDoubleAccess (in category 'tests - array by handle') -----
+ test08ByArrayHandleDoubleAccess
+
+ | type handle |
+ type := ExternalType double.
+ ExternalType useArrayClassesDuring: [
+ handle := (self allocate: type size: 5) getHandle].
+ self assert: 0.0 equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: 1.23456.
+ type handle: handle atIndex: 1 put: 0.0.
+ self assert: 1.23456 equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test09ByArrayHandleCharAccess (in category 'tests - array by handle') -----
+ test09ByArrayHandleCharAccess
+
+ | type handle |
+ type := ExternalType char.
+ ExternalType useArrayClassesDuring: [
+ handle := (self allocate: type size: 5) getHandle].
+ self assert: Character null equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: $A.
+ type handle: handle atIndex: 1 put: Character null.
+ self assert: $A equals: (type handle: handle atIndex: 2).!

Item was added:
+ ----- Method: FFIAllocateTests>>test10ByArrayHandleBoolAccess (in category 'tests - array by handle') -----
+ test10ByArrayHandleBoolAccess
+
+ | type handle |
+ type := ExternalType bool.
+ ExternalType useArrayClassesDuring: [
+ handle := (self allocate: type size: 5) getHandle].
+ self assert: false equals: (type handle: handle atIndex: 2).
+ type handle: handle atIndex: 2 put: true.
+ type handle: handle atIndex: 1 put: false.
+ self assert: true equals: (type handle: handle atIndex: 2).!