projects
/
fw
/
sdcc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/SDCCast.c (resultTypePropagate, decorateType): avoid promotion to int for compl...
[fw/sdcc]
/
support
/
regression
/
tests
/
muldiv.c
diff --git
a/support/regression/tests/muldiv.c
b/support/regression/tests/muldiv.c
index c1bb3e513aa0fc193bde7228ac4a60208e88e80c..b354d35278fb7cfef2b613ae533489c3078f8f0b 100644
(file)
--- a/
support/regression/tests/muldiv.c
+++ b/
support/regression/tests/muldiv.c
@@
-1,12
+1,12
@@
/** Simple test for the mul/div/mod operations.
/** Simple test for the mul/div/mod operations.
- type: int, char, short
+ type: int, char, short
, long
storage: static,
attr: volatile,
*/
#include <testfwk.h>
storage: static,
attr: volatile,
*/
#include <testfwk.h>
-
static
void
+void
testUnsignedModDiv(void)
{
{attr} {storage} unsigned {type} i;
testUnsignedModDiv(void)
{
{attr} {storage} unsigned {type} i;
@@
-27,7
+27,7
@@
testUnsignedModDiv(void)
ASSERT(result == 32);
}
ASSERT(result == 32);
}
-
static
void
+void
testUnsignedMul(void)
{
{attr} {storage} unsigned {type} i;
testUnsignedMul(void)
{
{attr} {storage} unsigned {type} i;
@@
-35,15
+35,15
@@
testUnsignedMul(void)
i = 37;
i = 37;
- LOG(("i*3 == 111 = %u\n",
i*3
));
+ LOG(("i*3 == 111 = %u\n",
(int)(i*3)
));
result = i*3;
ASSERT(result == 111);
result = i*12;
result = i*3;
ASSERT(result == 111);
result = i*12;
- ASSERT(result == (({type})444));
+ ASSERT(result == ((
unsigned
{type})444));
}
}
-
static
void
+void
testMul(void)
{
{attr} {storage} signed {type} i;
testMul(void)
{
{attr} {storage} signed {type} i;
@@
-51,22
+51,24
@@
testMul(void)
i = 5;
i = 5;
- LOG(("i*5 == 25 = %u\n", (int)
i*5
));
+ LOG(("i*5 == 25 = %u\n", (int)
(i*5)
));
result = i*5;
ASSERT(result == 25);
result = i*5;
ASSERT(result == 25);
- LOG(("i*-4 == -20 = %u\n", (int)
i*-4
));
+ LOG(("i*-4 == -20 = %u\n", (int)
(i*-4)
));
ASSERT(i*-4 == -20);
i = -10;
ASSERT(i*-4 == -20);
i = -10;
- LOG(("i*12 == -120 = %u\n", (int)
i*12
));
+ LOG(("i*12 == -120 = %u\n", (int)
(i*12)
));
ASSERT(i*12 == -120);
ASSERT(i*12 == -120);
- LOG(("i*-3 == 30 = %u\n", (int)
i*-3
));
+ LOG(("i*-3 == 30 = %u\n", (int)
(i*-3)
));
ASSERT(i*-3 == 30);
ASSERT(i*-3 == 30);
+}
- LOG(("30 == %u\n", (int)i*-3));
+void mark(void)
+{
}
}
-
static
void
+void
testDiv(void)
{
{attr} {storage} signed {type} i;
testDiv(void)
{
{attr} {storage} signed {type} i;
@@
-75,6
+77,7
@@
testDiv(void)
LOG(("i/5 == 20 = %u\n", (int)i/5));
ASSERT(i/5 == 20);
LOG(("i/-4 == -25 = %u\n", (int)i/-4));
LOG(("i/5 == 20 = %u\n", (int)i/5));
ASSERT(i/5 == 20);
LOG(("i/-4 == -25 = %u\n", (int)i/-4));
+ mark();
ASSERT(i/-4 == -25);
i = -50;
ASSERT(i/-4 == -25);
i = -50;
@@
-84,7
+87,7
@@
testDiv(void)
ASSERT(i/-12 == 4);
}
ASSERT(i/-12 == 4);
}
-
static
void
+void
testMod(void)
{
{attr} {storage} signed {type} i;
testMod(void)
{
{attr} {storage} signed {type} i;
@@
-95,7
+98,6
@@
testMod(void)
// LOG(("i%%17 == 15 = %u\n", (int)(i%9)));
ASSERT(i%17 == 15);
// LOG(("i%%17 == 15 = %u\n", (int)(i%9)));
ASSERT(i%17 == 15);
-#if MOD_SIGN_FOLLOWS_DIVIDEND
// LOG(("i%%-7 == 2 = %u\n", (int)i%-7));
ASSERT(i%-7 == 2);
// LOG(("i%%-7 == 2 = %u\n", (int)i%-7));
ASSERT(i%-7 == 2);
@@
-104,5
+106,4
@@
testMod(void)
ASSERT(i%3 == -1);
// LOG(("i%%-5 == -4 = %u\n", (int)i%-5));
ASSERT(i%-5 == -4);
ASSERT(i%3 == -1);
// LOG(("i%%-5 == -4 = %u\n", (int)i%-5));
ASSERT(i%-5 == -4);
-#endif
}
}