void test_LZ78_Compression_Variable_mode_given_input_file_sampleText_forCompresssion_2() { InStream *in = initInStream(); OutStream *out = initOutStream(); Dictionary *dictionary = initDictionary(100); in = openInStream("test/support/Source/sampleText_forCompresssion_2.txt", "rb" , in); out = openOutStream("test/support/Compressed/Variable/sampleText_forCompresssion_Compressed_Variable_2.txt", "wb" , out); LZ78_Compressor(dictionary,in,out,Variable); TEST_ASSERT_EQUAL_STRING("A",dictionary->Entry[0].data); TEST_ASSERT_EQUAL_STRING("AA",dictionary->Entry[1].data); TEST_ASSERT_EQUAL_STRING("AAA",dictionary->Entry[2].data); TEST_ASSERT_EQUAL_STRING("AAA ",dictionary->Entry[3].data); TEST_ASSERT_EQUAL_STRING("B",dictionary->Entry[4].data); TEST_ASSERT_EQUAL_STRING("BB",dictionary->Entry[5].data); TEST_ASSERT_EQUAL_STRING("BBB",dictionary->Entry[6].data); TEST_ASSERT_EQUAL_STRING("BBBB",dictionary->Entry[7].data); TEST_ASSERT_EQUAL_STRING("C",dictionary->Entry[8].data); TEST_ASSERT_EQUAL_STRING("",dictionary->Entry[9].data); closeInStream(in); closeOutStream(out); freeInStream(in); freeOutStream(out); destroyDictionary(dictionary,100); }
void test_lzwEncoder_encode_ban(){ CEXCEPTION_T e; OutStream *out; InStream *in; Dictionary *dictionary = dictionaryNew(4000); currentByte = 0; in = openInStream("test/Data/LZWDecodeOutput_3.txt", "rb"); out = openOutStream("test/Data/LZWDecodeOutput_3_enc.txt", "wb"); lzwEncoder(in, dictionary, out); }
void test_openOutStream_should_open_file_successfully(void) { OutStream *out = initOutStream(); out = openOutStream("test/support/zzz.txt", "rb" , out); TEST_ASSERT_NOT_NULL(out); TEST_ASSERT_NOT_NULL(out->file); TEST_ASSERT_EQUAL("test/support/zzz.txt", out->filename); closeOutStream(out); freeOutStream(out); }
void test_lzwEncoder_encode_246(){ CEXCEPTION_T e; OutStream *out; InStream *in; Dictionary *dictionary = dictionaryNew(4000); currentByte = 0; Try{ in = openInStream("test/Data/LZW_encode_246.txt", "rb"); }Catch(e){ TEST_ASSERT_EQUAL(ERR_CANNOT_OPEN_FILE, e); } out = openOutStream("test/Data/LZW_encode_246_enc.txt", "wb"); lzwEncoder(in, dictionary, out); }
void test_LZ78_Compression_Variable_mode_given_input_file_libjansson_4_dll_() { InStream *in = initInStream(); OutStream *out = initOutStream(); Dictionary *dictionary = initDictionary(4096); in = openInStream("test/support/Source/libjansson-4.dll", "rb" , in); out = openOutStream("test/support/Compressed/Variable/libjansson-4_Compressed_Variable.dll", "wb" , out); LZ78_Compressor(dictionary,in,out,Variable); closeInStream(in); closeOutStream(out); freeInStream(in); freeOutStream(out); destroyDictionary(dictionary,4096); }
void test_streamWriteBits_given_A_bitSize_8_should_flush_A_during_closeOutStream() { OutStream *out = initOutStream(); out = openOutStream("test/support/test_streamWriteBits.txt", "wb" , out); streamWriteBits(out,'A',8); TEST_ASSERT_EQUAL('A',out->byteToWrite); TEST_ASSERT_EQUAL(8,out->bitIndex); closeOutStream(out); TEST_ASSERT_EQUAL(0,out->byteToWrite); TEST_ASSERT_EQUAL(0,out->bitIndex); freeOutStream(out); }
void test_streamWriteBits_given_ABCDEFGH_bitSize_64_should_flush_ABCDEFGH() { char *string = "ABCDEFGH" ; int i ; OutStream *out = initOutStream(); out = openOutStream("test/support/test_streamWriteBits_1.txt", "wb" , out); for( i = 0 ; i < strlen(string) ; i ++ ) streamWriteBits(out,string[i],8); closeOutStream(out); TEST_ASSERT_EQUAL(0,out->byteToWrite); TEST_ASSERT_EQUAL(0,out->bitIndex); freeOutStream(out); }