#include "blitz/misc/Test.h"

#include "blitz/misc/Compression.h"

void ReciprocalTest() {
	blitz::DataBuffer original;
    original << "Some data to compress and decompress";

	// Use your compression functions here
	blitz::DataBuffer compressed = blitz::utils::Compress(original);
	blitz::DataBuffer decompressed = blitz::utils::Decompress(compressed);

	// Check that after compressing and then decompressing, we get back the original data
	blitz_test_assert(original == decompressed);
}

void CompressionTest() {
	blitz::DataBuffer original;
    original << "Some data to compresssssssssssssssssssssssssssssssssssssssssssssssssssssssssss";

	// Use your compression functions here
	blitz::DataBuffer compressed = blitz::utils::Compress(original);

	// Check that the compressed data is smaller than the original
	blitz_test_assert(compressed.GetSize() < original.GetSize());
}

void DecompressionTest() {
	blitz::DataBuffer original;
    original << "Some data to compress and decompress";

	// Use your compression functions here
	blitz::DataBuffer compressed = blitz::utils::Compress(original);
	blitz::DataBuffer decompressed = blitz::utils::Decompress(compressed);

	// Check that the decompressed data is the same size as the original
	blitz_test_assert(original.GetSize() == decompressed.GetSize());
}

int main() {
	ReciprocalTest();
	CompressionTest();
	DecompressionTest();
	return BLITZ_TEST_SUCCESSFUL;
}