UserInput.test.in 948 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! @BASH@
. ./cdoTestFunctions.test

echo 1..3 # Number of tests to be executed.
#
test -n "$CDO"      || CDO="@abs_top_builddir@/src/cdo $CDO_DEBUG"
test -n "$DATAPATH" || DATAPATH="@abs_top_srcdir@/test/data/"
#
rm -f ut_f*
#
FORMAT="-f srv -b 32"
declare -a INPUT
#
NTEST=1
RSTAT=0
#
INPUT=("1337,global_1" "1337 global_1" "1337 \\global_1")
RES="userInputRes.srv"
OUTPUT_FILE="userInputOutput.srv"
USER_INPUT="userInput_testFile"
#
$CDO $FORMAT const,1337,global_1 $RES
for i in {0..2};
do
    if [ -z "$1" ] || [ $NTEST == $1 ]; then
        echo ${INPUT[$i]} >> $USER_INPUT
        $CDO $FORMAT const $OUTPUT_FILE < $USER_INPUT
        test $? -eq 0 || let RSTAT+=1
        $CDO $FORMAT diff $RES $OUTPUT_FILE
        test $? -eq 0 || let RSTAT+=1

        test $RSTAT -eq 0 && echo "ok $NTEST - $CDOTEST"
        test $RSTAT -eq 0 || echo "not ok $NTEST - $CDOTEST"
        rm -f $USER_INPUT
    fi
    let NTEST+=1
done

rm -f $OUTPUT_FILE