Skip to content

Commit ba869b4

Browse files
committed
add auto to cpp static analysis check
1 parent 3ea2846 commit ba869b4

File tree

2 files changed

+40
-26
lines changed

2 files changed

+40
-26
lines changed
Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
11
{
2-
"resource_limits" : {
3-
"RLIMIT_CPU" : 60,
4-
"RLIMIT_NPROC" : 100,
5-
"RLIMIT_AS" : "RLIM_INFINITY"
6-
},
2+
"resource_limits" : {
3+
"RLIMIT_CPU" : 60,
4+
"RLIMIT_NPROC" : 100,
5+
"RLIMIT_AS" : "RLIM_INFINITY"
6+
},
77

8-
"testcases" : [
9-
{
10-
// Static analysis can also be performed upon C++ code.
11-
// Here, no compilation is performed at all; instead, student code is examined to
12-
// ensure that it does not use the "goto" keyword.
13-
"title" : "C++ - Check for goto",
14-
"type" : "Compilation",
15-
"command" : [ "submitty_count_token -l c goto *.cpp" ],
16-
"points" : 10,
17-
"validation" : [
8+
// Static analysis can also be performed upon C++ code.
9+
// Here, no compilation is performed at all; instead, student code is examined to
10+
// ensure that it does not use either the "goto" or "auto" keywords.
11+
"testcases" : [
1812
{
19-
"method" : "intComparison",
20-
"actual_file" : "STDOUT.txt",
21-
"description" : "Number of `goto`",
22-
"comparison" : "eq",
23-
"term" : 0,
24-
"failure_message" : "You must not use the `goto` keyword.",
25-
"show_message" : "on_failure",
26-
"show_actual" : "never"
13+
14+
"title" : "Check for goto and auto",
15+
"command" : [ "submitty_count_token -l c goto *.cpp",
16+
"submitty_count_token -l c auto *.cpp" ],
17+
"points" : 2,
18+
"validation" : [
19+
{
20+
// number of goto must be 0
21+
"method" : "intComparison",
22+
"actual_file" : "STDOUT_0.txt",
23+
"description" : "Number of `goto`",
24+
"comparison" : "eq",
25+
"term" : 0,
26+
"failure_message" : "You must not use the `goto` keyword.",
27+
"show_message" : "on_failure",
28+
"show_actual" : "never"
29+
},
30+
{
31+
// number of auto must be 0
32+
"method" : "intComparison",
33+
"actual_file" : "STDOUT_1.txt",
34+
"description" : "Number of `auto`",
35+
"comparison" : "eq",
36+
"term" : 0,
37+
"failure_message" : "You must not use the `auto` keyword.",
38+
"show_message" : "on_failure",
39+
"show_actual" : "never"
40+
}
41+
]
2742
}
28-
]
29-
}
30-
]
43+
]
3144
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
int main() {
22
foo:
3+
auto x = 1;
34
goto foo;
45
}

0 commit comments

Comments
 (0)