#!/bin/sh
# alcc computes ed2k links. For a file smaller than one ed2k chunk the hash is
# plain MD4, so the RFC 1320 test vectors give the expected links.
set -eu

cd "${AUTOPKGTEST_TMP:-$(mktemp -d)}"
printf 'abc' > abc.txt
printf 'message digest' > md.txt

expected='ed2k://|file|abc.txt|3|a448017aaf21d8525fc10ae87aa6729d|/
ed2k://|file|md.txt|14|d9130a8164549fe818874806e1c7014b|/'
out=$(alcc abc.txt md.txt 2>&1)
echo "$out"
if [ "$out" != "$expected" ]; then
	echo "FAIL: expected"
	echo "$expected"
	exit 1
fi
