Skip to content

Commit acfb253

Browse files
committed
Rule 7.0.6: Additional function return test cases
1 parent 778b344 commit acfb253

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

cpp/misra/test/rules/RULE-7-0-6/NumericAssignmentTypeMismatch.expected

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@
2828
| test.cpp:215:9:215:10 | 42 | Assignment between incompatible numeric types from 'int' to 'long'. |
2929
| test.cpp:244:23:244:24 | 42 | Assignment between incompatible numeric types from 'int' to 'unsigned long'. |
3030
| test.cpp:254:19:254:25 | ... + ... | Assignment between incompatible numeric types from 'int' to 'int16_t'. |
31-
| test.cpp:288:8:288:9 | l6 | Assignment between incompatible numeric types from 'uint32_t &' to 'uint8_t'. |
32-
| test.cpp:289:8:289:9 | l7 | Assignment between incompatible numeric types from 'int8_t &' to 'uint8_t'. |
33-
| test.cpp:290:9:290:10 | l8 | Assignment between incompatible numeric types from 'float &' to 'int32_t'. |
34-
| test.cpp:301:6:301:7 | l3 | Assignment between incompatible numeric types from 'uint8_t &' to 'int64_t'. |
35-
| test.cpp:302:6:302:7 | l4 | Assignment between incompatible numeric types from 'uint16_t &' to 'int32_t'. |
36-
| test.cpp:313:8:313:9 | l3 | Assignment between incompatible numeric types from 'uint8_t &' to 'int8_t'. |
37-
| test.cpp:314:8:314:9 | l4 | Assignment between incompatible numeric types from 'int8_t &' to 'uint8_t'. |
38-
| test.cpp:327:9:327:10 | l4 | Assignment between incompatible numeric types from 'float &' to 'int32_t'. |
39-
| test.cpp:328:7:328:8 | l5 | Assignment between incompatible numeric types from 'double &' to 'float'. |
40-
| test.cpp:329:7:329:8 | l6 | Assignment between incompatible numeric types from 'int32_t &' to 'float'. |
41-
| test.cpp:340:8:340:14 | ... + ... | Assignment between incompatible numeric types from 'int' to 'uint8_t'. |
42-
| test.cpp:358:7:358:8 | l3 | Assignment between incompatible numeric types from 'uint16_t &' to 'uint32_t'. |
43-
| test.cpp:361:7:361:8 | l5 | Assignment between incompatible numeric types from 'uint64_t &' to 'uint32_t'. |
31+
| test.cpp:259:10:259:12 | u32 | Assignment between incompatible numeric types from 'uint32_t' to 'int32_t'. |
32+
| test.cpp:292:8:292:9 | l6 | Assignment between incompatible numeric types from 'uint32_t &' to 'uint8_t'. |
33+
| test.cpp:293:8:293:9 | l7 | Assignment between incompatible numeric types from 'int8_t &' to 'uint8_t'. |
34+
| test.cpp:294:9:294:10 | l8 | Assignment between incompatible numeric types from 'float &' to 'int32_t'. |
35+
| test.cpp:305:6:305:7 | l3 | Assignment between incompatible numeric types from 'uint8_t &' to 'int64_t'. |
36+
| test.cpp:306:6:306:7 | l4 | Assignment between incompatible numeric types from 'uint16_t &' to 'int32_t'. |
37+
| test.cpp:317:8:317:9 | l3 | Assignment between incompatible numeric types from 'uint8_t &' to 'int8_t'. |
38+
| test.cpp:318:8:318:9 | l4 | Assignment between incompatible numeric types from 'int8_t &' to 'uint8_t'. |
39+
| test.cpp:331:9:331:10 | l4 | Assignment between incompatible numeric types from 'float &' to 'int32_t'. |
40+
| test.cpp:332:7:332:8 | l5 | Assignment between incompatible numeric types from 'double &' to 'float'. |
41+
| test.cpp:333:7:333:8 | l6 | Assignment between incompatible numeric types from 'int32_t &' to 'float'. |
42+
| test.cpp:344:8:344:14 | ... + ... | Assignment between incompatible numeric types from 'int' to 'uint8_t'. |
43+
| test.cpp:362:7:362:8 | l3 | Assignment between incompatible numeric types from 'uint16_t &' to 'uint32_t'. |
44+
| test.cpp:365:7:365:8 | l5 | Assignment between incompatible numeric types from 'uint64_t &' to 'uint32_t'. |

cpp/misra/test/rules/RULE-7-0-6/test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ std::int32_t f12(std::int8_t l1) {
255255
return l1; // COMPLIANT
256256
}
257257

258+
std::int32_t test_return() {
259+
return u32; // NON_COMPLIANT - wrong signedness
260+
}
261+
258262
// Test switch cases
259263
void test_switch_cases() {
260264
switch (s8) {

0 commit comments

Comments
 (0)