#!/bin/bash
set -e
[ -n "$1" ] || ( echo "file arg required"; false )
./build.sh
echo "arch $1 -> $1.ar"
./arch deflate "$1" "$1.ar"
echo "archived"
echo "extract $1.ar -> $1.copy"
./arch inflate "$1.ar" "$1.copy"
echo "extracted"
echo "compare with original"
cmp "$1" "$1.copy" || ( echo "ERROR: files differ"; false )
echo "files are equal"
echo "done"