aboutsummaryrefslogtreecommitdiff
path: root/test/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/main.cpp')
-rw-r--r--test/main.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/main.cpp b/test/main.cpp
index d4c2e64..8dc9de5 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -1,7 +1,9 @@
+#include <bitset>
#include <reader.h>
#include <debug.h>
#include <PNGImage.h>
#include <BMPImage.h>
+#include <HashTable.h>
#include <zlib.h>
#include <cstdint>
#include <cstring>
@@ -16,6 +18,40 @@ int main(int argc, char* argv[])
cout << "usage: " << argv[0] << " <in file> <out file>" << endl;
return 1;
}
+
+ TehImage::ZLib encoder;
+ TehImage::ZLib decoder;
+
+ const int inSize = 1000;
+ uint8_t in[inSize];
+ for(int i = 0; i < 10; i++)
+ {
+ for(int j = 0; j < 100; j++)
+ {
+ in[i*100+j] = i;
+ }
+ }
+
+ const int encodedSize = 1024;
+ uint8_t encoded[encodedSize];
+
+ int compressedSize = encoder.encodeData(in, inSize, encoded, encodedSize);
+
+ // for(int i = 0; i < compressedSize; i++)
+ // {
+ // cout << std::bitset<8>(encoded[i]) << endl;
+ // }
+
+ uint8_t out[inSize];
+ int decodedSize = decoder.decodeData(encoded, encodedSize, out, inSize);
+ cout << ((memcmp(in, out, inSize) == 0)?"Pass":"Fail") << ", Size: " << compressedSize << endl;
+
+ // for(int i = 0; i < inSize; i++)
+ // {
+ // cout << 0 + in[i] << " " << 0 + out[i] << endl;
+ // }
+
+ return 0;
std::string infile = argv[1];
std::string outfile = argv[2];