#!/usr/bin/env bash
# This script runs textEnhance with three different
# example input files (each of which is a typical
# text file as you would find it on a Linux, Windows
# or MacOS system, respectively). The actual content
# of the files ("what the user sees", i.e. ignoring
# encoding etc.) is the same for all three, which is
# why this script then asserts that that the files are
# identical after enhancement. If they're not, the
# script aborts.

set -e

repo_dir=$HOME/MAUS/TOOL/textEnhance

cd $repo_dir/testfiles/typical-cases/original
for file in *; do
    echo "Enhancing '$file'"
    $repo_dir/textEnhance -v $file -o ../enhanced/$file \
        --brackets '[]{}' \
        --left-bracket '*#' \
        --replace-whitespace-char '_'
done

cd ../enhanced
for file in *; do
    diff -q typical-linux-file $file
done

cd ..
rm enhanced/*
