#!/bin/sh

FILESET=`ls -d ../digest-auth*`;
AWK_COMMAND="/code 2/ {print \"code 2\"} /code 3/ {print \"code 3\"} /no response/ {print \"no response\"}";

for TEST_FILE in $FILESET
  do
  RESPONSE_CODE=`../../main/radclient localhost auth testing123 -r 1 -t 2 -f ${TEST_FILE} 2>&1 | awk "${AWK_COMMAND}"`
  
  case "${RESPONSE_CODE}" in
      "code 2") printf "Test %-30s : passed\n" $TEST_FILE;;
      "code 3") printf "Test %-30s : failed (user auth failure)\n" $TEST_FILE;;
      "no response") printf "Test %-30s : failed (no response)\n" $TEST_FILE;;
  esac
done

