blob: fd8fa7d8f74d646a91d9eb25ba4bdf084d5dcfa0 (
plain)
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
|
#!./cppawk -f
BEGIN {
RS = "--\n"
FS = ":\n"
}
function runtest(id, code, output,
failed)
{
print code > "script.sh"
print output > "output"
failed = 0
if (output == "ERR\n") {
if (system("sh script.sh > /dev/null 2>&1") == 0)
failed = 1
} else if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) {
failed = 1
}
if (failed)
printf("test %s failed\n", id)
close("script.sh")
close("output")
}
$1 {
runtest($1, $2, $3)
}
|