From b3bc42fcb4c6e08ec20401a60d7df1482d6932ac Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Wed, 11 Jan 2017 19:17:32 +0330 Subject: tdd for 10.5, added a few more. --- test/testFuncs2.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/testFuncs2.c b/test/testFuncs2.c index ffe8686..4f289a3 100644 --- a/test/testFuncs2.c +++ b/test/testFuncs2.c @@ -328,17 +328,26 @@ void testfunc12(void) { const char* stringlit = "date should be in the form ??-??-??"; - short int port = 0x5aU; - short int resultshort; - int resultlong; - int mode; - resultshort = (~port) >> 4; - resultshort = ((short int)(~port)) >> 4; + short unsigned int port = 0x005aU; + unsigned char portchar = 0x005aU; + short unsigned int resultshort; + const unsigned char charconst = 4U; + unsigned int resultlong; + unsigned int mode; + resultshort = (~port) >> 4U; + resultshort = port << 4U; + resultshort = (short unsigned int)(port << 4U); + resultshort = (short signed int)(port << 4U); + resultshort = portchar << 4U; + resultshort = (unsigned char)(portchar << charconst); + resultshort = ((short unsigned int)(~port)) >> 4U; /*should not be tagged by 10.1\2*/ - resultlong = ((int)(~(int)port)) >> 4; + resultlong = ((int)(~(int)port)) >> 4U; - resultlong = ((port << 4) & mode) >> 6; - resultlong = ((int)((int)port << 4) & mode) >> 6; + /*not comliant*/ + resultlong = ((port << 4U) & mode) >> 6U; + /*compliant*/ + resultlong = ((unsigned int)((unsigned int)port << 4U) & mode) >> 6U; } /*the test are from the misrac doc for 11.5*/ -- cgit v1.2.3