xaizek / for-postfix (License: GPLv2+) (since 2018-12-07)
Clang-based standalone tool that detects for-loops with postfix operators.
Commit 79ec411233a634f6f3ed2cbc4248224f17e02c3c

Add some test files
Author: xaizek
Author date (UTC): 2014-03-24 20:10
Committer name: xaizek
Committer date (UTC): 2014-03-24 20:34
Parent(s): 40b769b50b74a0e3c0d8dd1a279d005a051dbc36
Signing key:
Tree: ac7d2f8bebfc1d45be315d51fd3b590ae72c0838
File Lines added Lines deleted
test-files/all.cpp 50 0
test-files/primitive-all.cpp 29 0
test-files/primitive-dec.cpp 21 0
test-files/primitive-inc.cpp 21 0
test-files/vector-all.cpp 34 0
File test-files/all.cpp added (mode: 100644) (index 0000000..107f097)
1 #include <cstdlib>
2
3 #include <vector>
4
5 inline void
6 doNothing()
7 {
8 // do nothing on purpose
9 }
10
11 int
12 main()
13 {
14 for (int i = 0; i < 5; i--) {
15 doNothing();
16 }
17
18 for (int i = 0; i < 5; --i) {
19 doNothing();
20 }
21
22 for (int i = 0; i < 5; i++) {
23 doNothing();
24 }
25
26 for (int i = 0; i < 5; ++i) {
27 doNothing();
28 }
29
30 std::vector<int> v;
31 typedef std::vector<int> IntVector;
32
33 for (IntVector::const_iterator cit = v.begin(); cit != v.end(); cit++) {
34 doNothing();
35 }
36
37 for (IntVector::const_iterator cit = v.begin(); cit != v.end(); ++cit) {
38 doNothing();
39 }
40
41 for (IntVector::const_iterator cit = v.begin(); cit != v.end(); cit--) {
42 doNothing();
43 }
44
45 for (IntVector::const_iterator cit = v.begin(); cit != v.end(); --cit) {
46 doNothing();
47 }
48
49 return EXIT_SUCCESS;
50 }
File test-files/primitive-all.cpp added (mode: 100644) (index 0000000..64cb726)
1 #include <cstdlib>
2
3 inline void
4 doNothing()
5 {
6 // do nothing on purpose
7 }
8
9 int
10 main(void)
11 {
12 for (int i = 0; i < 10; i++) {
13 doNothing();
14 }
15
16 for (int i = 0; i < 10; ++i) {
17 doNothing();
18 }
19
20 for (int i = 0; i < 10; i--) {
21 doNothing();
22 }
23
24 for (int i = 0; i < 10; --i) {
25 doNothing();
26 }
27
28 return EXIT_SUCCESS;
29 }
File test-files/primitive-dec.cpp added (mode: 100644) (index 0000000..3ca9f3d)
1 #include <cstdlib>
2
3 inline void
4 doNothing()
5 {
6 // do nothing on purpose
7 }
8
9 int
10 main(void)
11 {
12 for (int i = 0; i < 10; i--) {
13 doNothing();
14 }
15
16 for (int i = 0; i < 10; --i) {
17 doNothing();
18 }
19
20 return EXIT_SUCCESS;
21 }
File test-files/primitive-inc.cpp added (mode: 100644) (index 0000000..adc0cea)
1 #include <cstdlib>
2
3 inline void
4 doNothing()
5 {
6 // do nothing on purpose
7 }
8
9 int
10 main(void)
11 {
12 for (int i = 0; i < 10; i++) {
13 doNothing();
14 }
15
16 for (int i = 0; i < 10; ++i) {
17 doNothing();
18 }
19
20 return EXIT_SUCCESS;
21 }
File test-files/vector-all.cpp added (mode: 100644) (index 0000000..42aa3d3)
1 #include <cstdlib>
2
3 #include <vector>
4
5 inline void
6 doNothing()
7 {
8 // do nothing on purpose
9 }
10
11 int
12 main(void)
13 {
14 std::vector<int> v;
15 typedef std::vector<int> intVector;
16
17 for (intVector::const_iterator cit = v.begin(); cit != v.end(); cit++) {
18 doNothing();
19 }
20
21 for (intVector::const_iterator cit = v.begin(); cit != v.end(); ++cit) {
22 doNothing();
23 }
24
25 for (intVector::const_iterator cit = v.begin(); cit != v.end(); cit--) {
26 doNothing();
27 }
28
29 for (intVector::const_iterator cit = v.begin(); cit != v.end(); --cit) {
30 doNothing();
31 }
32
33 return EXIT_SUCCESS;
34 }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/for-postfix

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/for-postfix

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master