C++: add more tests and rename test functions

This commit is contained in:
Robert Marsh
2019-01-23 11:42:44 -08:00
parent 64ed9305d3
commit fa02042fda
2 changed files with 22 additions and 11 deletions

View File

@@ -1,3 +1,3 @@
| test.c:7:3:7:5 | call to foo | This call has arguments, but $@ is not declared with any parameters. | test.c:1:6:1:8 | foo | foo |
| test.c:13:3:13:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:13:3:13:3 | not_yet_declared1 | not_yet_declared1 |
| test.c:13:3:13:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:17:6:17:22 | not_yet_declared1 | not_yet_declared1 |
| test.c:8:3:8:16 | call to declared_empty | This call has arguments, but $@ is not declared with any parameters. | test.c:1:6:1:19 | declared_empty | declared_empty |
| test.c:14:3:14:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:14:3:14:3 | not_yet_declared1 | not_yet_declared1 |
| test.c:14:3:14:19 | call to not_yet_declared1 | This call has arguments, but $@ is not declared with any parameters. | test.c:25:6:25:22 | not_yet_declared1 | not_yet_declared1 |

View File

@@ -1,18 +1,29 @@
void foo();
void bar(void);
void baz(int);
void declared_empty();
void declared_void(void);
void declared_with(int);
void declared_empty_defined_with();
void test() {
foo(); // GOOD
foo(1); // BAD
bar(); // GOOD
baz(1); // GOOD
declared_empty(); // GOOD
declared_empty(1); // BAD
declared_void(); // GOOD
declared_with(1); // GOOD
undeclared(1); // GOOD
not_yet_declared1(1); // BAD
not_yet_declared2(1); // GOOD
declared_empty_defined_with(); // BAD
declared_empty_defined_with(1); // GOOD
int x;
declared_empty_defined_with(&x); // BAD
declared_empty_defined_with(x, x); // BAD
}
void not_yet_declared1();
void not_yet_declared2(int);
void not_yet_declared2(int);
void declared_empty_defined_with(int x) {
// do nothing
}