Added test for multiple elements.

pull/22/head
weetmuts 2019-04-04 08:36:22 +02:00
rodzic 85c3015e8c
commit ebe9a30583
4 zmienionych plików z 35 dodań i 0 usunięć

Wyświetl plik

@ -14,6 +14,7 @@ tests/test_shell.sh $PROG
tests/test_meterfiles.sh $PROG
tests/test_config1.sh $PROG
tests/test_logfile.sh $PROG
tests/test_elements.sh $PROG
tests/test_listen_to_all.sh $PROG
tests/test_multiple_ids.sh $PROG
#tests/test_oneshot.sh $PROG broken test

Wyświetl plik

@ -0,0 +1,7 @@
loglevel=normal
device=simulations/simulation_multiple_qcalorics.txt
logtelegrams=false
format=json
meterfiles=testoutput/meter_readings3
meterfilesaction=append
logfile=testoutput/thelog3.txt

Wyświetl plik

@ -0,0 +1,4 @@
name=Element
type=qcaloric
id=*
key=

Wyświetl plik

@ -0,0 +1,23 @@
#!/bin/bash
PROG="$1"
TEST=testoutput
mkdir -p $TEST/meter_readings3
rm -f $TEST/meter_readings3/Element
cat simulations/simulation_multiple_qcalorics.txt | grep '^{' > $TEST/test_expected.txt
$PROG --useconfig=tests/config3 > $TEST/test_output.txt
if [ "$?" == "0" ]
then
cat $TEST/meter_readings3/Element | sed 's/"timestamp":"....-..-..T..:..:..Z"/"timestamp":"1111-11-11T11:11:11Z"/' > $TEST/test_responses.txt
diff $TEST/test_expected.txt $TEST/test_responses.txt
if [ "$?" == "0" ]
then
echo Elements OK
fi
else
echo Failure.
exit 1
fi