#include <iostream>

#include "Lz77Encoder.h"
#include "HuffmanEncoder.h"
#include "BufferBitStream.h"

#include "TestFramework.h"

TEST_CASE(TestLz77Encoder, "compression")
{
    std::vector<unsigned> values {0, 10, 11, 12, 10, 11, 12, 0, 13, 14, 15, 10, 11, 12};

    //std::vector<unsigned> values {0, 1, 2, 3, 0, 1, 2, 3, 0,1};

    BufferBitStream input_stream;
    for (auto value : values)
    {
        input_stream.writeByte(value);
    }

    BufferBitStream output_stream;

    Lz77Encoder encoder(&input_stream, &output_stream);

    encoder.encode();

    auto hit_buffer = encoder.getHitBuffer();
    //for(const auto& hit : hit_buffer)
    //{
        //const auto& [length, distance, next_char] = hit;
        //std::cout << "Got hit " << length << " | " << distance << " | " << static_cast<int>(next_char) << std::endl;
    //}

    HuffmanEncoder huffman_encoder;
    huffman_encoder.initializeTrees(hit_buffer);
}
