Fix testsoon.nim for 32 bit systems.

This commit is contained in:
cheatfate 2018-05-22 13:59:47 +03:00
parent 1ca4415106
commit 7330027f7e
1 changed files with 19 additions and 19 deletions

View File

@ -18,21 +18,21 @@ proc callback1(udata: pointer) {.gcsafe.} =
soonTest1 += int(cast[uint](udata))
proc test1(): int =
callSoon(callback1, cast[pointer](0x12345678))
callSoon(callback1, cast[pointer](0x23456789))
callSoon(callback1, cast[pointer](0x3456789A))
callSoon(callback1, cast[pointer](0x456789AB))
callSoon(callback1, cast[pointer](0x56789ABC))
callSoon(callback1, cast[pointer](0x6789ABCD))
callSoon(callback1, cast[pointer](0x789ABCDE))
callSoon(callback1, cast[pointer](0x89ABCDEF))
callSoon(callback1, cast[pointer](0x9ABCDEF1))
callSoon(callback1, cast[pointer](0xABCDEF12))
callSoon(callback1, cast[pointer](0xBCDEF123))
callSoon(callback1, cast[pointer](0xCDEF1234))
callSoon(callback1, cast[pointer](0xDEF12345))
callSoon(callback1, cast[pointer](0xEF123456))
callSoon(callback1, cast[pointer](0xF1234567))
callSoon(callback1, cast[pointer](0x01234567))
callSoon(callback1, cast[pointer](0x02345678))
callSoon(callback1, cast[pointer](0x03456789))
callSoon(callback1, cast[pointer](0x0456789A))
callSoon(callback1, cast[pointer](0x056789AB))
callSoon(callback1, cast[pointer](0x06789ABC))
callSoon(callback1, cast[pointer](0x0789ABCD))
callSoon(callback1, cast[pointer](0x089ABCDE))
callSoon(callback1, cast[pointer](0x09ABCDEF))
callSoon(callback1, cast[pointer](0x0ABCDEF1))
callSoon(callback1, cast[pointer](0x0BCDEF12))
callSoon(callback1, cast[pointer](0x0CDEF123))
callSoon(callback1, cast[pointer](0x0DEF1234))
callSoon(callback1, cast[pointer](0x0EF12345))
callSoon(callback1, cast[pointer](0x0F123456))
## All callbacks must be processed exactly with 1 poll() call.
poll()
result = soonTest1
@ -57,10 +57,10 @@ proc test2(): int =
when isMainModule:
suite "callSoon() tests suite":
test "User-defined callback argument test":
var expect = 0x12345678 + 0x23456789 + 0x3456789A + 0x456789AB +
0x56789ABC + 0x6789ABCD + 0x789ABCDE + 0x89ABCDEF +
0x9ABCDEF1 + 0xABCDEF12 + 0xBCDEF123 + 0xCDEF1234 +
0xDEF12345 + 0xEF123456 + 0xF1234567
var expect = 0x01234567 + 0x02345678 + 0x03456789 + 0x0456789A +
0x056789AB + 0x06789ABC + 0x0789ABCD + 0x089ABCDE +
0x09ABCDEF + 0x0ABCDEF1 + 0x0BCDEF12 + 0x0CDEF123 +
0x0DEF1234 + 0x0EF12345 + 0x0F123456
check test1() == expect
test "callSoon() behavior test":
check test2() == CallSoonTests