[squeak-dev] FFI: FFI-Tests-mt.67.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Apr 13 09:53:38 UTC 2022
Marcel Taeumel uploaded a new version of FFI-Tests to project FFI:
http://source.squeak.org/FFI/FFI-Tests-mt.67.mcz
==================== Summary ====================
Name: FFI-Tests-mt.67
Author: mt
Time: 13 April 2022, 11:53:38.025201 am
UUID: 129d19d3-e784-8c4e-8013-edf5e1d7b143
Ancestors: FFI-Tests-mt.66
Makes "long long" tests more useful.
=============== Diff against FFI-Tests-mt.66 ===============
Item was changed:
----- Method: FFIPluginTests>>testLongLong (in category 'tests - atomics') -----
testLongLong
"Test passing and returning longlongs"
+
+ #(
+ 1073741823 "SmallInteger 32-bit maxVal" 1
+ -1073741824 "SmallInteger 32-bit minVal" -1
+ 2147483647 "ExternalType int32_t maxVal" 1
+ -2147483648 "ExternalType int32_t minVal" -1
+ 4294967295 "ExternalType uint32_t maxVal" 1
+ 16rFFFFFFFFFFFFFFF "SmallInteger 64-bit maxVal" 1
+ -16r1000000000000000 "SmallInteger 64-bit minVal" -1
+ ) pairsDo: [:arg1 :arg2 |
+ {
+ arg1 . arg2 .
+ arg1 . arg1 .
+ arg1 . arg1 negated - 1 .
+ arg1 + arg2 . arg2 .
+ arg1 + arg2 . arg1 + arg2 .
+ } pairsDo: [:a :b |
+ | result |
+ result := self invoke: 'ffiTestLongLong' with: a with: b.
+ self assert: a + b equals: result]].!
- | long1 long2 long3 |
- long1 := 16r123456789012.
- long2 := (-1 << 31).
- long3 := self invoke: 'ffiTestLongLong' with: long1 with: long2.
- self assert: (long1 + long2) equals: long3.!
Item was changed:
----- Method: FFIPluginTests>>testLongLong8 (in category 'tests - atomics') -----
testLongLong8
| long1 long2 bytes result |
bytes := (1 to: 8) asArray.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
+ long2 := (-1 << 31) "ExternalType int32_t minVal" - 1.
- long1 := 16r123456789012.
- long2 := (-1 << 31).
result := self invoke: 'ffiTestLongLong8' withArguments: bytes, { long1 . long2 }.
self assert: (bytes sum + long1 + long2) equals: result.!
Item was changed:
----- Method: FFIPluginTests>>testLongLong8a1 (in category 'tests - atomics') -----
testLongLong8a1
| long1 long2 bytes result |
bytes := (1 to: 9) asArray.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
+ long2 := (-1 << 31) "ExternalType int32_t minVal" - 1.
- long1 := 16r123456789012.
- long2 := (-1 << 31).
result := self invoke: 'ffiTestLongLong8a1' withArguments: bytes, { long1 . long2 }.
self assert: (bytes sum + long1 + long2) equals: result.!
Item was changed:
----- Method: FFIPluginTests>>testLongLong8a2 (in category 'tests - atomics') -----
testLongLong8a2
| long1 long2 bytes result |
bytes := (1 to: 10) asArray.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
+ long2 := (-1 << 31) "ExternalType int32_t minVal" - 1.
- long1 := 16r123456789012.
- long2 := (-1 << 31).
result := self invoke: 'ffiTestLongLong8a2' withArguments: bytes, { long1 . long2 }.
self assert: (bytes sum + long1 + long2) equals: result.!
Item was changed:
----- Method: FFIPluginTests>>testLongLongA1 (in category 'tests - atomics') -----
testLongLongA1
"Test passing a char and two longlongs."
| byte long1 long2 result |
byte := 42.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
+ long2 := (-1 << 31) "ExternalType int32_t minVal" - 1.
- long1 := 16r123456789012.
- long2 := (-1 << 31).
result := self invoke: 'ffiTestLongLonga1' with: byte with: long1 with: long2.
self assert: (byte + long1 + long2) equals: result.!
Item was changed:
----- Method: FFIPluginTests>>testLongLongA2 (in category 'tests - atomics') -----
testLongLongA2
| byte1 byte2 long1 long2 result |
byte1 := 3.
byte2 := 4.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
+ long2 := (-1 << 31) "ExternalType int32_t minVal" - 1.
- long1 := 16r123456789012.
- long2 := (-1 << 31).
result := self invoke: 'ffiTestLongLonga2' with: byte1 with: byte2 with: long1 with: long2.
self assert: (byte1 + byte2 + long1 + long2) equals: result.!
Item was changed:
----- Method: FFIPluginTests>>testLongLongA3 (in category 'tests - atomics') -----
testLongLongA3
"Test passing a char, a longlong, and another char."
| byte1 long1 byte2 result |
byte1 := 3.
+ long1 := 1 << 31 - 1 "ExternalType int32_t maxVal" + 1.
- long1 := 16r123456789012.
byte2 := 4.
result := self invoke: 'ffiTestLongLonga3' with: byte1 with: long1 with: byte2.
self assert: (byte1 + long1 + byte2) equals: result.!
More information about the Squeak-dev
mailing list
|