-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test.sh
More file actions
executable file
·49 lines (40 loc) · 791 Bytes
/
Copy pathrun_test.sh
File metadata and controls
executable file
·49 lines (40 loc) · 791 Bytes
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
#!/bin/sh
set -e
prog="./rpkgs.sh"
test_dir="./testing_files"
outdir="${test_dir}/output"
expdir="${test_dir}/expected"
run_test () {
title="$1"
out="${outdir}/${title}.out"
expected="${expdir}/${title}.expected"
sh "$prog" ${test_dir}/${title}.R | sort > "$out"
if [ ! -z "$(diff -q "$expected" "$out")" ]; then
echo "Fail" "$title"
else
echo "Ok" "$title"
fi
}
run_all () {
run_test "library"
run_test "require"
run_test "doublecolon_1"
run_test "p_load_test1"
run_test "p_load_test2"
run_test "p_load_test3"
}
echo "$(run_all)" |
awk '
BEGIN {
count_ok = 0;
count_fail = 0;
}
{
printf("%s\t%s\n", $1, $2);
$1 == "Ok" ? (count_ok++) : (count_fail++);
}
END {
printf("\nSummary:\n");
printf("Ok\t%d\n", count_ok);
printf("Fail\t%d\n", count_fail);
}'