Skip to content
Snippets Groups Projects
Commit 1bd45ca6 authored by Yaman Umuroglu's avatar Yaman Umuroglu
Browse files

[Test] add test_array2hexstring

parent 2ab3d32b
No related branches found
No related tags found
No related merge requests found
from finn.core.datatype import DataType
from finn.core.utils import array2hexstring
def test_array2hexstring():
assert array2hexstring([1, 1, 1, 0], DataType.BINARY, 4) == "e"
assert array2hexstring([1, 1, 1, 0], DataType.BINARY, 8) == "0e"
assert array2hexstring([1, 1, 1, -1], DataType.BIPOLAR, 8) == "0e"
assert array2hexstring([3, 3, 3, 3], DataType.UINT2, 8) == "ff"
assert array2hexstring([1, 3, 3, 1], DataType.UINT2, 8) == "7d"
assert array2hexstring([1, -1, 1, -1], DataType.INT2, 8) == "77"
assert array2hexstring([1, 1, 1, -1], DataType.INT4, 16) == "111f"
assert array2hexstring([-1], DataType.FLOAT32, 32) == "bf800000"
assert array2hexstring([17.125], DataType.FLOAT32, 32) == "41890000"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment