@@ -24,6 +24,12 @@ def test_unsigned16(self):
24
24
self .assertEqual (var .decode_raw (b"\xfe \xff " ), 65534 )
25
25
self .assertEqual (var .encode_raw (65534 ), b"\xfe \xff " )
26
26
27
+ def test_unsigned24 (self ):
28
+ var = od .ODVariable ("Test UNSIGNED24" , 0x1000 )
29
+ var .data_type = od .UNSIGNED24
30
+ self .assertEqual (var .decode_raw (b"\xfd \xfe \xff " ), 16776957 )
31
+ self .assertEqual (var .encode_raw (16776957 ), b"\xfd \xfe \xff " )
32
+
27
33
def test_unsigned32 (self ):
28
34
var = od .ODVariable ("Test UNSIGNED32" , 0x1000 )
29
35
var .data_type = od .UNSIGNED32
@@ -46,6 +52,14 @@ def test_integer16(self):
46
52
self .assertEqual (var .encode_raw (- 2 ), b"\xfe \xff " )
47
53
self .assertEqual (var .encode_raw (1 ), b"\x01 \x00 " )
48
54
55
+ def test_integer24 (self ):
56
+ var = od .ODVariable ("Test INTEGER24" , 0x1000 )
57
+ var .data_type = od .INTEGER24
58
+ self .assertEqual (var .decode_raw (b"\xfe \xff \xff " ), - 2 )
59
+ self .assertEqual (var .decode_raw (b"\x01 \x00 \x00 " ), 1 )
60
+ self .assertEqual (var .encode_raw (- 2 ), b"\xfe \xff \xff " )
61
+ self .assertEqual (var .encode_raw (1 ), b"\x01 \x00 \x00 " )
62
+
49
63
def test_integer32 (self ):
50
64
var = od .ODVariable ("Test INTEGER32" , 0x1000 )
51
65
var .data_type = od .INTEGER32
0 commit comments