def test_encoder_c5(self): encoder = RunLengthEncoder() text = "abc123xyz" expected_result = "1a1b1c1112131x1y1z" self.assertEqual(encoder.encode_c(text), expected_result)
from run_length_encoder import RunLengthEncoder encoder = RunLengthEncoder() string_to_compress = "abc123xyzaaabbbcccd" print(f"Compressing string: {string_to_compress}") # result = encoder.encode_a(string_to_compress) # print(result) result = encoder.encode_b(string_to_compress) print(result) # result = encoder.encode_c(string_to_compress) # print(result)
def test_encoder_c4(self): encoder = RunLengthEncoder() text = "1223334444" expected_result = "11223344" self.assertEqual(encoder.encode_c(text), expected_result)
def test_encoder_c3(self): encoder = RunLengthEncoder() text = "abcabcabcabcabcabc" expected_result = "1a1b1c1a1b1c1a1b1c1a1b1c1a1b1c1a1b1c" self.assertEqual(encoder.encode_c(text), expected_result)
def test_encoder_c2(self): encoder = RunLengthEncoder() text = "aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnoooppp" expected_result = "3a3b3c3d3e3f3g3h3i3j3k3l3m3n3o3p" self.assertEqual(encoder.encode_c(text), expected_result)
def test_encoder_a(self): encoder = RunLengthEncoder() text = "aaabbcdddd" expected_result = "3a2bc4d" self.assertEqual(encoder.encode_a(text), expected_result)
def test_encoder_a5(self): encoder = RunLengthEncoder() text = "abc123xyz" expected_result = "abc123xyz" self.assertEqual(encoder.encode_a(text), expected_result)