From f504a8fec78521b79b736a281cb93c6ea87a3abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Menk=C3=BCc?= Date: Sun, 10 Mar 2024 14:05:39 +0100 Subject: [PATCH] add test --- tests/test_nrPolarEncode.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/test_nrPolarEncode.py diff --git a/tests/test_nrPolarEncode.py b/tests/test_nrPolarEncode.py new file mode 100644 index 0000000..1e86f4c --- /dev/null +++ b/tests/test_nrPolarEncode.py @@ -0,0 +1,14 @@ +import numpy as np +import pytest +from py3gpp.nrPolarEncode import nrPolarEncode + +def test_nrPolarEncode(): + nmax = 9 + payload = np.ones(100).astype(int) + cw = nrPolarEncode(payload, 512, nmax=nmax) + cw_desired = np.array([0,1,0,0,0,1,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1,1,0,0,0,1,0,1,1,0,0,1,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,0,1,0,0,1,1,0,0,1,1,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0,0,1,0,1,1,0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,1,0,1,0,1,1,1,1,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,1,1,0,0,0,0,1,0,1,1,0,1,0,1,1,0,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,0,1,1,1,1,1,1,0,1,1,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1,0,0,0,0,0,0,1,1,0,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,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