aboutsummaryrefslogtreecommitdiffstats
path: root/test/testFuncs3.c
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2017-01-08 13:54:45 +0000
committerbloodstalker <thabogre@gmail.com>2017-01-08 13:54:45 +0000
commit527f7a44b94cd969aa4b9e26cba02b6cb23724e5 (patch)
tree44b664a3a4d1060d0f8f985455a08ee560af279f /test/testFuncs3.c
parentupdated the implemented misra-c2004 rule count.its 127 (diff)
downloadmutator-527f7a44b94cd969aa4b9e26cba02b6cb23724e5.tar.gz
mutator-527f7a44b94cd969aa4b9e26cba02b6cb23724e5.zip
added tdd tests for 12.12
Diffstat (limited to '')
-rw-r--r--test/testFuncs3.c56
1 files changed, 51 insertions, 5 deletions
diff --git a/test/testFuncs3.c b/test/testFuncs3.c
index 7d31764..54c6737 100644
--- a/test/testFuncs3.c
+++ b/test/testFuncs3.c
@@ -1,16 +1,18 @@
/*first line intentionally left blank.*/
+/*********************************************************************************************************************/
int crappyint;
-
+/*********************************************************************************************************************/
+/*inclusion directives*/
#include "testFuncs3.h"
#include <complex.h>
-
-
+/*********************************************************************************************************************/
+/*globals*/
int intarray3[3][2] = MACRO1;
int intarray4[3][2] = MACRO2;
int answer = ANSWER;
-
+/*********************************************************************************************************************/
void tddfunc1 (void)
{
double complex z1 = 10.0 + 10.0 * I;
@@ -57,8 +59,52 @@ void tddfunc3(void)
READ_TIME_34();
}
-void tddfunc4(void)
+int* tddfunc4(void)
{
+ int localauto;
+ return (&localauto);
+}
+void tddfunc5(void)
+{
+ int arrint[4];
+ arrint[0] = 052;
+ arrint[1] = 067;
+ arrint[2] = 100;
+ arrint[3] = 786;
+}
+
+/*12.12 tdd*/
+void tddfunc6(void)
+{
+ float floatbitaccess;
+ int* pointertofloat;
+ int apartoffloat;
+ /*@DEVI-you cannot get away with this since c90 and c99 both specify that operands to & need to both be of integral types.*/
+ /*embedded compilers might not necessarily be ISO-C-complete so apparently this might be actually viable in some cases but
+ if the clang parser won't let this through, i can't analyze it so we can't check for this.*/
+#if 0
+ apartoffloat = floatbitaccess & 0x000000FF;
+#endif
+ /*this results in a bticast castexpr which we are already tagging,clang does too, so im not overly concerned with this one
+ though its fairly east to implement.*/
+ pointertofloat = &floatbitaccess;
+
+ /*we could literally just tag all unions having float members as possible violations.*/
+ union aunion
+ {
+ float member1;
+ union member2
+ {
+ unsigned char member3;
+ unsigned char member4;
+ unsigned char member5;
+ unsigned char member6;
+ } member22;
+ } aunionproto;
+
+ aunionproto.member1 = floatbitaccess;
+ apartoffloat = aunionproto.member22.member5 & 0x000000FF;
}
+/*********************************************************************************************************************/
/*last line intnetionally left blank.*/