DUNE-DAQ
DUNE Trigger and Data Acquisition software
Toggle main menu visibility
Loading...
Searching...
No Matches
dunedaq
sourcecode
detdataformats
scripts
DAQEthHeader_binding_test.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
3
import
sys
4
from
detdataformats
import
DAQEthHeader
5
6
7
def
main
() -> int:
8
9
header_size = DAQEthHeader.sizeof()
10
if
header_size <= 0:
11
print(
"DAQEthHeader sizeof test failed"
)
12
return
1
13
else
:
14
print(
"DAQEthHeader sizeof test passed"
)
15
16
header = DAQEthHeader(bytes(header_size))
17
print(
"DAQEthHeader created from raw bytes"
)
18
19
header.version = 5
20
if
header.version != 5:
21
print(
"DAQEthHeader version property test failed"
)
22
return
1
23
24
header.det_id = 3
25
if
header.det_id != 3:
26
print(
"DAQEthHeader det_id property test failed"
)
27
return
1
28
29
header.crate_id = 100
30
if
header.crate_id != 100:
31
print(
"DAQEthHeader crate_id property test failed"
)
32
return
1
33
34
header.slot_id = 7
35
if
header.slot_id != 7:
36
print(
"DAQEthHeader slot_id property test failed"
)
37
return
1
38
39
header.stream_id = 42
40
if
header.stream_id != 42:
41
print(
"DAQEthHeader stream_id property test failed"
)
42
return
1
43
44
header.reserved = 12
45
if
header.reserved != 12:
46
print(
"DAQEthHeader reserved property test failed"
)
47
return
1
48
49
header.seq_id = 4095
50
if
header.seq_id != 4095:
51
print(
"DAQEthHeader seq_id property test failed"
)
52
return
1
53
54
header.block_length = 256
55
if
header.block_length != 256:
56
print(
"DAQEthHeader block_length property test failed"
)
57
return
1
58
59
header.timestamp = 0x1234567890ABCDEF
60
if
header.timestamp != 0x1234567890ABCDEF:
61
print(
"DAQEthHeader timestamp property test failed"
)
62
return
1
63
64
print(
"DAQEthHeader basic read/write property tests passed"
)
65
66
if
header.get_timestamp() != 0x1234567890ABCDEF:
67
print(
"DAQEthHeader get_timestamp() test failed"
)
68
return
1
69
70
print(
"DAQEthHeader get_timestamp() test passed"
)
71
72
print(
"\nAll DAQEthHeader Python binding tests passed"
)
73
return
0
74
75
if
__name__ ==
"__main__"
:
76
sys.exit(
main
())
DAQEthHeader_binding_test.main
int main()
Definition
DAQEthHeader_binding_test.py:7
Generated on
for DUNE-DAQ by
1.17.0