C++: Enhance MagicConstantsNumbers test

This commit is contained in:
Ian Lynagh
2018-10-12 16:32:57 +01:00
parent 894a37ccda
commit ef1552339e
2 changed files with 21 additions and 0 deletions

View File

@@ -19,3 +19,6 @@
| functions.h:3:14:3:16 | 102 | Magic constant: literal '102' is repeated 21 times and should be encapsulated in a constant. |
| functions.h:3:14:3:16 | 102 | Magic constant: literal '102' is repeated 21 times and should be encapsulated in a constant. |
| functions.h:12:11:12:13 | 103 | Magic constant: literal '103' is repeated 21 times and should be encapsulated in a constant. |
| templates.cpp:4:5:4:6 | 23 | Magic constant: literal '23' is repeated 21 times and should be encapsulated in a constant. |
| templates.cpp:4:5:4:6 | 23 | Magic constant: literal '23' is repeated 21 times and should be encapsulated in a constant. |
| templates.cpp:13:5:13:6 | 25 | Magic constant: literal '25' is repeated 21 times and should be encapsulated in a constant. |

View File

@@ -0,0 +1,18 @@
template <typename T>
void f(T x) {
23;
23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23; 23;
'A';
'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A'; 'A';
}
void g(void) {
int i;
f(i);
25;
25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25; 25;
'B';
'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B'; 'B';
}