18 lines
513 B
Python
18 lines
513 B
Python
#!/usr/bin/env python3
|
|
import unittest
|
|
|
|
from pyfroniusreg import froniusreg
|
|
|
|
|
|
class TestDataTypes(unittest.TestCase):
|
|
def test_int16(self):
|
|
int16_buffer = froniusreg.int16.encode_to_buffer(1024)
|
|
assert int16_buffer == [b"\x04\x00"]
|
|
|
|
def test_int16_decode(self):
|
|
int16_register = [0x0, 0x1, 0x0, 0x0, 0x0, 0x5, 0x1, 0x3, 0x2, 0x0, 0x0]
|
|
output = froniusreg.int16.decode_from_register(int16_register)
|
|
assert output == 0
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|