File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ import pycyphal
2
+
3
+ # noinspection PyProtectedMember
4
+ from pycyphal .application .register ._value import _strictify
5
+
6
+
7
+ async def _unittest_strictify_bool () -> None :
8
+ s = [True , False ]
9
+ v = _strictify (s ).bit .value
10
+ assert (s == v ).all ()
11
+
12
+
13
+ async def _unittest_strictify_u64 () -> None :
14
+ s = [x * 1000000 for x in range (30 )]
15
+ v = _strictify (s ).natural64 .value
16
+ assert (s == v ).all ()
17
+
18
+
19
+ async def _unittest_strictify_u32 () -> None :
20
+ s = [x * 1000000 for x in range (60 )]
21
+ v = _strictify (s ).natural32 .value
22
+ assert (s == v ).all ()
23
+
24
+
25
+ async def _unittest_strictify_u16 () -> None :
26
+ s = [x * 100 for x in range (80 )]
27
+ v = _strictify (s ).natural16 .value
28
+ assert (s == v ).all ()
29
+
30
+
31
+ async def _unittest_strictify_i64 () -> None :
32
+ s = [- x * 1000000 for x in range (30 )]
33
+ v = _strictify (s ).integer64 .value
34
+ assert (s == v ).all ()
35
+
36
+
37
+ async def _unittest_strictify_int64 () -> None :
38
+ s = [- x * 1000000 for x in range (60 )]
39
+ v = _strictify (s ).integer32 .value
40
+ assert (s == v ).all ()
41
+
42
+
43
+ async def _unittest_strictify_int128 () -> None :
44
+ s = [- x * 100 for x in range (80 )]
45
+ v = _strictify (s ).integer16 .value
46
+ assert (s == v ).all ()
You can’t perform that action at this time.
0 commit comments