-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_nop.nim
More file actions
39 lines (32 loc) · 944 Bytes
/
test_nop.nim
File metadata and controls
39 lines (32 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import unittest2
import nimuring
suite "nop operation":
test "basic nop submit and completion":
var q = newQueue(1, {})
q.nop(cast[pointer](0xaaaaaaaa))
check q.sqReady() == 1
check q.cqReady() == 0
check q.submit() == 1
check q.sqReady() == 0
check q.cqReady() == 1
var cqes = q.copyCqes(1)
check cqes.len == 1
check cqes[0].userData == 0xaaaaaaaa.uint64
check q.sqReady() == 0
check q.cqReady() == 0
test "drainPrevious and second nop":
var q = newQueue(1, {})
q.nop(cast[pointer](0xaaaaaaaa))
discard q.submit()
discard q.copyCqes(1)
let sqe = q.nop(cast[pointer](0xbbbbbbbb))
sqe.drainPrevious()
check q.sqReady() == 1
check q.cqReady() == 0
check q.submit() == 1
check q.sqReady() == 0
let cqes = q.copyCqes(1)
check cqes.len == 1
check cqes[0].userData == 0xbbbbbbbb.uint64
check q.sqReady() == 0
check q.cqReady() == 0