function get_tempdir_name() {
  echo "$BATS_TMPDIR/$( echo ${1:-$BATS_TEST_FILENAME} $PPID | md5sum | awk '{ print $1 }' )"
}

function make_tempdir() {
  local tempdir=$( get_tempdir_name $1 )
  mkdir -p "$tempdir"
  echo "$tempdir"
}

function rm_tempdir() {
  local tempdir=$( get_tempdir_name $1 )
  rm --recursive --force -- "$tempdir"
}

for sum in md5sum md5
do
  if which -s $sum
  then
    CHECKSUM=$(which $sum)
    break
  fi
done

function get_tempdir_name() {
  echo "$BATS_TMPDIR/$( echo ${1:-$BATS_TEST_FILENAME} $PPID | $CHECKSUM | awk '{ print $1 }' )"
}

function make_tempdir() {
  local tempdir=$( get_tempdir_name $1 )
  mkdir -p "$tempdir"
  echo "$tempdir"
}

function rm_tempdir() {
  local tempdir=$( get_tempdir_name $1 )
  rm --recursive --force -- "$tempdir"
}

Choose first available MD5 utility
Choose first available MD5 utility

`md5sum` doesn't ship with macOS, but does ship with a functional
equivalent in `md5`. This commit adds a loop to check for these tools in
order, and use the first one found when generating temporary directories
for testing.
