@@ -7,90 +7,90 @@ python tools/extracttests.py --code=test1 $1
77
88cd test1
99
10- ../cppcheck -q . 2> 1.txt
10+ ../cppcheck -q --template=cppcheck1 . 2> 1.txt
1111
1212
1313# (!x) => (x==0)
1414sed -ri ' s/([(&][ ]*)\!([a-z]+)([ ]*[&)])/\1\2==0\3/' * .cpp
15- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
15+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
1616
1717# (x==0) => (0==x)
1818sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*==[ ]*0([ ]*[&)])/\10==\2\3/' * .cpp
19- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
19+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
2020
2121# (0==x) => (!x)
2222sed -ri ' s/([(&][ ]*)0[ ]*==[ ]*([a-z]+)([ ]*[&)])/\1!\2\3/' * .cpp
23- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
23+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
2424
2525
2626
2727
2828# if (x) => (x!=0)
2929sed -ri ' s/(if[ ]*\([ ]*[a-z]+)([ ]*[&)])/\1!=0\2/' * .cpp
30- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
30+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
3131
3232# while (x) => (x!=0)
3333sed -ri ' s/(while[ ]*\([ ]*[a-z]+)([ ]*[&)])/\1!=0\2/' * .cpp
34- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
34+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
3535
3636# (x!=0) => (0!=x)
3737sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*!=[ ]*0([ ]*[&)])/\10!=\2\3/' * .cpp
38- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
38+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
3939
4040# (0!=x) => (x)
4141sed -ri ' s/([(&][ ]*)0[ ]*!=[ ]*([a-z]+[ ]*[&)])/\1\2/' * .cpp
42- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
42+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
4343
4444
4545# (x < 0) => (0 > x)
4646sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*<[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3>\2\4/' * .cpp
47- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
47+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
4848
4949# (x <= 0) => (0 >= x)
5050sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*<=[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
51- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
51+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
5252
5353# (x > 0) => (0 < x)
5454sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*<=[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
55- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
55+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
5656
5757# (x >= 0) => (0 <= x)
5858sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*<=[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
59- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
59+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
6060
6161# (x == 123) => (123 == x)
6262sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*==[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3==\2\4/' * .cpp
63- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
63+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
6464
6565# (x != 123) => (123 != x)
6666sed -ri ' s/([(&][ ]*)([a-z]+)[ ]*\!=[ ]*(\-?[0-9]+)([ ]*[&)])/\1\3!=\2\4/' * .cpp
67- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
67+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
6868
6969
7070
7171# (0 < x) => (x > 0)
7272sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*<[ ]*([a-z]+)([ ]*[&)])/\1\3>\2\4/' * .cpp
73- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
73+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
7474
7575# (0 <= x) => (x >= 0)
7676sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*<=[ ]*([a-z]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
77- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
77+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
7878
7979# (0 > x) => (x < 0)
8080sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*<=[ ]*([a-z]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
81- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
81+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
8282
8383# (0 >= x) => (x <= 0)
8484sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*<=[ ]*([a-z]+)([ ]*[&)])/\1\3>=\2\4/' * .cpp
85- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
85+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
8686
8787# (123 == x) => (x == 123)
8888sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*==[ ]*([a-z]+)([ ]*[&)])/\1\3==\2\4/' * .cpp
89- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
89+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
9090
9191# (123 != x) => (x <= 123)
9292sed -ri ' s/([(&][ ]*)(\-?[0-9]+)[ ]*\!=[ ]*([a-z]+)([ ]*[&)])/\1\3!=\2\4/' * .cpp
93- ../cppcheck -q . 2> 2.txt && diff 1.txt 2.txt
93+ ../cppcheck -q --template=cppcheck1 . 2> 2.txt && diff 1.txt 2.txt
9494
9595
9696cd ..
0 commit comments