Loading tests/prrt/prrt_coding_configuration_test.py 0 → 100644 +38 −0 Original line number Diff line number Diff line import unittest import math # import os, sys # import pyximport # pyximport.install() # sys.path.append(os.path.join(os.path.dirname(__file__), '/home/local/Documents/thesis/hecps/code/PRRT/prrt')) import prrt # print(sys.path) # print(dir(prrt.__path__)) # print(prrt.__file__) class TestStringMethods(unittest.TestCase): def test_ri_01(self): print("Begin test 01: n, k, p_e, n_p: 5, 2, 0.1, [0, 1, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, 0.1, [0, 1, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.01445, rel_tol=1e-03) def test_ri_02(self): print("Begin test 02: n, k, p_e, n_p: 5, 2, 0.01, [0, 1, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, 0.01, [0, 1, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.0001490496, rel_tol=1e-03) def test_ri_03(self): print("Begin test 03: n, k, p_e, n_p: 8, 2, 0.1, [1, 1, 2, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(8, 2, 0.1, [1, 1, 2, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.50190719, rel_tol=1e-03) if __name__ == '__main__': unittest.main() No newline at end of file Loading
tests/prrt/prrt_coding_configuration_test.py 0 → 100644 +38 −0 Original line number Diff line number Diff line import unittest import math # import os, sys # import pyximport # pyximport.install() # sys.path.append(os.path.join(os.path.dirname(__file__), '/home/local/Documents/thesis/hecps/code/PRRT/prrt')) import prrt # print(sys.path) # print(dir(prrt.__path__)) # print(prrt.__file__) class TestStringMethods(unittest.TestCase): def test_ri_01(self): print("Begin test 01: n, k, p_e, n_p: 5, 2, 0.1, [0, 1, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, 0.1, [0, 1, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.01445, rel_tol=1e-03) def test_ri_02(self): print("Begin test 02: n, k, p_e, n_p: 5, 2, 0.01, [0, 1, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, 0.01, [0, 1, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.0001490496, rel_tol=1e-03) def test_ri_03(self): print("Begin test 03: n, k, p_e, n_p: 8, 2, 0.1, [1, 1, 2, 2]") prrt_cc_obj = prrt.PrrtCodingConfiguration(8, 2, 0.1, [1, 1, 2, 2]) prrt_cc_obj = prrt_cc_obj.get_redundant_information() print(prrt_cc_obj) assert math.isclose(prrt_cc_obj, 0.50190719, rel_tol=1e-03) if __name__ == '__main__': unittest.main() No newline at end of file