forked from coala/coala-bears
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCPPCheckBearTest.py
37 lines (31 loc) · 901 Bytes
/
CPPCheckBearTest.py
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
from bears.c_languages.CPPCheckBear import CPPCheckBear
from coalib.testing.LocalBearTestHelper import verify_local_bear
good_file = """
using namespace std;
int main() {
cout << "Hello, world!" << endl;
return 0;
}"""
warn_file = """
void f1(struct fred_t *p)
{
int x;
if (p)
do_something(x);
}"""
bad_file = """
#define f(c) { \
char s[10]; \
s[c] = 42; \
}
int main() {
f(100);
return 0;
}"""
CPPCheckBearTest1 = verify_local_bear(CPPCheckBear,
valid_files=(good_file, warn_file),
invalid_files=(bad_file,))
CPPCheckBearTest2 = verify_local_bear(CPPCheckBear,
valid_files=(good_file,),
invalid_files=(warn_file, bad_file),
settings={'enable': 'unusedFunction'})