def test_03_decodefile(self):
     huffman_decode("file3_soln_compressed.txt", "decodetest3.txt")
     # capture errors by running 'filecmp' on your encoded file
     # with a *known* solution file
     self.assertTrue(filecmp.cmp("decodetest3.txt", "file3.txt"))
Exemplo n.º 2
0
 def test_blank_file(self):
     huffman_encode("blank.txt", "encode_blank.txt")
     huffman_decode("encode_blank_compressed.txt", "blank_decode.txt")
     self.assertTrue(filecmp.cmp("blank.txt", "blank_decode.txt"))
Exemplo n.º 3
0
 def test_decode_and_encode_1(self):
     huffman_encode("test1.txt", "encode_test1_soln.txt")
     huffman_decode("encode_test1_soln_compressed.txt", "test_decode.txt")
     self.assertTrue(filecmp.cmp("test_decode.txt", "test1.txt"))
Exemplo n.º 4
0
 def test_03_decodefile(self):
     freqlist = cnt_freq("test3.txt")
     huffman_decode(freqlist, "test3.out", "decodetest3.txt")
     # capture errors by running 'filecmp' on your encoded file
     # with a *known* solution file
     self.assertTrue(filecmp.cmp("decodetest3.txt", "test3.txt"))
Exemplo n.º 5
0
 def test_05_decode_single_char(self):
     huffman_decode("encodetest0_compressed.txt", "decode_single.txt")
     self.assertTrue(filecmp.cmp("decode_single.txt", "file0.txt"))
Exemplo n.º 6
0
 def test_04_decode_empty(self):
     huffman_decode("empty_encode_compressed.txt", "empty_decoded.txt")
     self.assertTrue(
         filecmp.cmp("empty_decoded.txt", "empty_encode_compressed.txt"))