Loading tests/prrt/prrt_coding_configuration_test.py +15 −17 Original line number Diff line number Diff line Loading @@ -11,28 +11,26 @@ import prrt # 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.1, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, [0, 1, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(5, 2, [0, 1, 2]) , p_e = 0.1 >> ", ri) assert math.isclose(ri, 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.01, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, [0, 1, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(5, 2, [0, 1, 2]), p_e = 0.01 >> ", ri) assert math.isclose(ri, 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.1, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(8, 2, [1, 1, 2, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(8, 2, [1, 1, 2, 2]), p_e = 0.1 >> ", ri) assert math.isclose(ri, 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 +15 −17 Original line number Diff line number Diff line Loading @@ -11,28 +11,26 @@ import prrt # 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.1, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, [0, 1, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(5, 2, [0, 1, 2]) , p_e = 0.1 >> ", ri) assert math.isclose(ri, 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.01, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(5, 2, [0, 1, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(5, 2, [0, 1, 2]), p_e = 0.01 >> ", ri) assert math.isclose(ri, 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) prrt_cp_obj = prrt.PrrtChannelParameters(0.1, 0, 0, 0, 0, 0) prrt_cc_obj = prrt.PrrtCodingConfiguration(8, 2, [1, 1, 2, 2]) ri = prrt_cc_obj.get_redundant_information(prrt_cp_obj) print("RI for test config: (n, k, n_p)=(8, 2, [1, 1, 2, 2]), p_e = 0.1 >> ", ri) assert math.isclose(ri, 0.50190719, rel_tol=1e-03) if __name__ == '__main__': unittest.main() No newline at end of file