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

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

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

Name: FFI-Tests-mt.30
Author: mt
Time: 7 May 2021, 6:52:54.95064 pm
UUID: 9e06096e-b5c4-5848-abb5-b98200c4d9f4
Ancestors: FFI-Tests-mt.29

More tests =)

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

Item was changed:
  ----- Method: ExternalTypeTests>>testAllocateAtomicsExternal (in category 'tests') -----
  testAllocateAtomicsExternal
+ "Note that #allocateExternal for atomics does not need an extra #free. See #allocateExternal."
 
  self should: [ExternalType void allocateExternal] raise: Error.
  self assert: false equals: ExternalType bool allocateExternal.
 
  self assert: 0 equals: ExternalType int8_t "sbyte" allocateExternal.
  self assert: 0 equals: ExternalType uint8_t "byte" allocateExternal.
 
  self assert: 0 equals: ExternalType uint16_t "ushort" allocateExternal.
  self assert: 0 equals: ExternalType int16_t "short" allocateExternal.
 
  self assert: 0 equals: ExternalType uint32_t "ulong" allocateExternal.
  self assert: 0 equals: ExternalType int32_t "long" allocateExternal.
 
  self assert: 0 equals: ExternalType uint64_t "ulonglong" allocateExternal.
  self assert: 0 equals: ExternalType int64_t "longlong" allocateExternal.
 
  self assert: Character null equals: ExternalType schar allocateExternal.
  self assert: Character null equals: ExternalType char allocateExternal.
 
  self assert: 0.0 equals: ExternalType float allocateExternal.
  self assert: 0.0 equals: ExternalType double allocateExternal.!

Item was added:
+ ----- Method: ExternalTypeTests>>testAtomicTypeRange (in category 'tests') -----
+ testAtomicTypeRange
+
+ self should: [ExternalType void minVal] raise: Error.
+ self should: [ExternalType void maxVal] raise: Error.
+
+ self should: [ExternalType bool minVal] raise: Error.
+ self should: [ExternalType bool maxVal] raise: Error.
+
+ self assert: 0 equals: ExternalType uint8_t "byte" minVal.
+ self assert: 255 equals: ExternalType uint8_t "byte" maxVal.
+ self assert: -128 equals: ExternalType int8_t "sbyte" minVal.
+ self assert: 127 equals: ExternalType int8_t "sbyte" maxVal.
+
+ self assert: 0 equals: ExternalType uint16_t "ushort" minVal.
+ self assert: 65535 equals: ExternalType uint16_t "ushort" maxVal.
+ self assert: -32768 equals: ExternalType int16_t "short" minVal.
+ self assert: 32767 equals: ExternalType int16_t "short" maxVal.
+
+ self assert: 0 equals: ExternalType uint32_t "ulong" minVal.
+ self assert: 4294967295 equals: ExternalType uint32_t "ulong" maxVal.
+ self assert: -2147483648 equals: ExternalType int32_t "long" minVal.
+ self assert: 2147483647 equals: ExternalType int32_t "long" maxVal.
+
+ self assert: 0 equals: ExternalType uint64_t "ulonglong" minVal.
+ self assert: 18446744073709551615 equals: ExternalType uint64_t "ulonglong" maxVal.
+ self assert: -9223372036854775808 equals: ExternalType int64_t "longlong" minVal.
+ self assert: 9223372036854775807 equals: ExternalType int64_t "longlong" maxVal.
+
+ self assert: Character null equals: ExternalType char "unsignedChar" minVal.
+ self assert: (Character value: 255) equals: ExternalType char "unsignedChar" maxVal.
+ self assert: (Character value: 128) equals: ExternalType signedChar "schar" minVal.
+ self assert: (Character value: 127) equals: ExternalType signedChar "schar" maxVal.
+
+ self assert: -3.4028234663852886e38 equals: ExternalType float minVal.
+ self assert: 3.4028234663852886e38 equals: ExternalType float maxVal.
+ self assert: -1.7976931348623157e308 equals: ExternalType double minVal.
+ self assert: 1.7976931348623157e308 equals: ExternalType double maxVal. !

Item was added:
+ ----- Method: ExternalTypeTests>>testPrecisionFloatTypes (in category 'tests') -----
+ testPrecisionFloatTypes
+
+ self
+ assert: ExternalType float isSinglePrecision;
+ assert: ExternalType double
+ equals: ExternalType float asDoublePrecision;
+ assert: ExternalType double isDoublePrecision;
+ assert: ExternalType float
+ equals: ExternalType float asSinglePrecision.!

Item was added:
+ ----- Method: ExternalTypeTests>>testPrecisionIntegerTypes (in category 'tests') -----
+ testPrecisionIntegerTypes
+
+ AtomicTypeNames do: [:typeName |
+ | type |
+ type := ExternalType atomicTypeNamed: typeName.
+ type isIntegerType ifTrue: [
+ self
+ should: [type isSinglePrecision]
+ raise: Error;
+ should: [type isDoublePrecision]
+ raise: Error]].!