Skip to content

Commit

Permalink
add matlab test for nrRateRecoverPolar()
Browse files Browse the repository at this point in the history
  • Loading branch information
catkira committed Aug 23, 2023
1 parent f4bbae0 commit 9024db4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/matlab/test_nrRateRecoverPolar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import matlab.engine
import itertools
import numpy as np
import pytest

from py3gpp.nrRateRecoverPolar import nrRateRecoverPolar

def run_nrRateRecoverPolar(N, eng):
K = 56
cw = np.arange(N)
ref_data = eng.nrRateRecoverPolar(eng.transpose(eng.double(cw)), eng.double(K), eng.double(N))
ref_data = np.array(list(itertools.chain(*ref_data)))

data = nrRateRecoverPolar(cw, K, N, False)

assert (ref_data == data).all()

@pytest.fixture(scope='session')
def eng():
eng = matlab.engine.connect_matlab()
yield eng
eng.quit()

@pytest.mark.parametrize("N", [512, 256, 128])
def test_nrRateRecoverPolar(N, eng):
run_nrRateRecoverPolar(N, eng)

if __name__ == '__main__':
_eng = matlab.engine.connect_matlab()
test_nrRateRecoverPolar(512, _eng)
_eng.quit()

0 comments on commit 9024db4

Please sign in to comment.