#!/usr/bin/env bash
echo "================================================================================"
echo -n "Testing \`zlibutil\`... "


echo "abc" >> testfile

bin/tools/zlibutil -c testfile

if [ "$(bin/tools/arraydump --binary testfile.compressed)" = "{0b01111000, 0b10011100, 0b01001011, 0b01001100, 0b01001010, 0b11100110, 0b00000010, 0b00000000, 0b00000011, 0b01111110, 0b00000001, 0b00110001}" ]; then
    echo -n "Compression Test: PASS... "
else
    echo -n "Compression Test: FAILED... "
fi

bin/tools/zlibutil -d testfile.compressed

if [ "$(bin/tools/arraydump --binary testfile.compressed.uncompressed)" = "{0b01100001, 0b01100010, 0b01100011, 0b00001010}" ]; then
    echo "Decompression Test: PASS"
else
    echo "Decompression Test: FAILED"
fi

rm testfile testfile.compressed testfile.compressed.uncompressed

echo "================================================================================"
