#!/bin/sh
############################################################################
#   Copyright 2007,2008 Impinj, Inc.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
############################################################################

STD_TESTS_DX101=../../Tests/dx101/

rm -f *.tmp

echo "================================================================"
echo "== Run dx101 on standard 'a' input to verify function."
echo "================================================================"
./dx101 $STD_TESTS_DX101/dx101_a_in.bin > dx101_a_out.tmp
if cmp -s dx101_a_out.tmp $STD_TESTS_DX101/dx101_a_out.txt
then
    echo DX101 A -- PASSED
else
    echo DX101 A -- FAILED
    exit
fi
echo ""
echo ""
echo ""



echo "===================================================="
echo "== Run dx101 on standard 'a' input with valgrind."
echo "== This verifies no memory leak."
echo "== Please inspect the output."
echo "== The line that says 'malloc/free: in use at exit:'"
echo "== should say ' 0 bytes in 0 blocks.'"
echo "===================================================="
valgrind ./dx101 $STD_TESTS_DX101/dx101_a_in.bin > /dev/null
echo ""
echo ""
echo ""



echo "===================================================="
echo "== Done with dx101 test series"
echo "===================================================="
