#!/bin/sh

# not set -e: we are testing exit codes

if ! [ -d "$ADTTMP" ]; then
	echo "ADTTMP not set." >&2
	exit 1
fi

echo "a" > $ADTTMP/a
echo "a" > $ADTTMP/a_
echo "b" > $ADTTMP/b

diffoscope $ADTTMP/a $ADTTMP/a_
if [ $? -ne 0 ]; then
	echo "Exit code was different from 0 when comparing files with identical content." >&2
	exit 1
fi

diffoscope $ADTTMP/a $ADTTMP/b
if [ $? -ne 1 ]; then
	echo "Exit code was different from 1 when comparing files with different content." >&2
	exit 1
fi
