-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·67 lines (53 loc) · 1.75 KB
/
test.sh
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash
# test tool
VENV=testenv
PYTHON3=python3
SCRIPT=./${VENV}/bin/akerun-sum
diff_outputfile() {
outfile=$1
orgfile=$2
inputfile=$3
errmasage="err when used [$3] and [$2]"
diff $outfile $orgfile > log
if [ $? -ne 0 ]; then
echo $errmasage
exit $?;
else
echo "$inputfile Success"
rm log
rm ${outfile}
fi
}
empty_outputfile() {
outfile=$1
inputfile=$2
errmasage="err when used [${inputfile}]"
if [ -e ${outfile} ]; then
echo ${errmessage}
exit 1
else
echo "$inputfile Success"
fi
}
init() {
python3 -m venv ${VENV}
./${VENV}/bin/python -m pip install -U pip setuptools wheel
./${VENV}/bin/python -m pip install .
}
init
${SCRIPT} -i test/input-utf8.csv -o output.csv -d 201610 -f 1 || exit $?
diff_outputfile output.csv test/output-utf8.csv test/input-utf8.csv
${SCRIPT} -i test/input-sjis.csv -o output.csv -d 201610 -f 1 || exit $?
diff_outputfile output.csv test/output-sjis.csv test/input-sjis.csv
${SCRIPT} -i test/input-euc.csv -o output.csv -d 201610 -f 1 || exit $?
diff_outputfile output.csv test/output-euc.csv test/input-euc.csv
${SCRIPT} -i test/input-anotherdate.csv -o output.csv -d 201702 -f 1 || exit $?
diff_outputfile output.csv test/output-anotherdate.csv test/input-anotherdate.csv
${SCRIPT} -i test/input-anotherdate.csv -o output-empty.csv -d 201703 -f 1 || exit $?
empty_outputfile output.csv test/input-anotherdate.csv
${SCRIPT} -i test/input-anotherformat.csv -o output.csv -d 201610 -f 0 || exit $?
diff_outputfile output.csv test/output-anotherformat.csv test/input-anotherformat.csv
${SCRIPT} -i test/input-anotherformat.csv -o output.csv -d 201610 || exit $?
diff_outputfile output.csv test/output-anotherformat.csv test/input-anotherformat.csv
rm -f output.csv
rm -r ${VENV}