1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!./cppawk -f BEGIN { RS = "--\n" FS = ":\n" } function runtest(id, code, output) { print code > "script.sh" print output > "output" if (system("[ \"$(sh script.sh)\" = \"$(cat output)\" ]") != 0) { printf("test %s failed\n", id) } close("script.sh") close("output") } $1 { runtest($1, $2, $3) }