#!/bin/bash
#
# $Id$
#
# test script for library functions
#

lib="../lib/mr_conf.c ../lib/mr_msg.c ../lib/mr_err.c ../lib/mr_mem.c"

echo "Generating test-msg"
gcc -O2 -g -I../common -I../include test-msg.c $lib -o test-msg
echo "Generating test-string"
gcc -O2 -g -I../common -I../include test-string.c ../lib/mr_str.c $lib -o test-string
echo "Generating test-conf"
gcc -O2 -g -I../common -I../include test-conf.c $lib -o test-conf

for f in test-conf test-string test-msg; do
	chmod 755 $f
	./$f > /tmp/$f.res
	diff -q $f.res /tmp/$f.res
	if [ $? -ne 0 ]; then
		echo "$f test KO !!"
	fi
done
