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

[Test] add negative-valued int32 testcases to packedbytearray

parent 02abad9a
No related branches found
No related tags found
No related merge requests found
......@@ -153,6 +153,12 @@ def test_finnpy_to_packed_bytearray():
D = [[1, 7, 2, 5], [2, 5, 1, 7]]
eD = np.asarray([[23, 37], [37, 23]], dtype=np.uint8)
assert (finnpy_to_packed_bytearray(D, DataType.UINT4) == eD).all()
E = [[-4, 0, -4, -4]]
eE = np.asarray(
[[255, 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 252, 255, 255, 255, 252]],
dtype=np.uint8,
)
assert (finnpy_to_packed_bytearray(E, DataType.INT32) == eE).all()
def test_packed_bytearray_to_finnpy():
......@@ -176,3 +182,11 @@ def test_packed_bytearray_to_finnpy():
eD = np.asarray(eD, dtype=np.float32)
shapeD = eD.shape
assert (packed_bytearray_to_finnpy(D, DataType.UINT4, shapeD) == eD).all()
E = np.asarray(
[[255, 255, 255, 252, 0, 0, 0, 0, 255, 255, 255, 252, 255, 255, 255, 252]],
dtype=np.uint8,
)
eE = [[-4, 0, -4, -4]]
eE = np.asarray(eE, dtype=np.float32)
shapeE = eE.shape
assert (packed_bytearray_to_finnpy(E, DataType.INT32, shapeE) == eE).all()
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