1 /** Simple test for the mul/div/mod operations.
3 type: int, char, short, long
10 testUnsignedModDiv(void)
12 {attr} {storage} unsigned {type} i;
13 unsigned {type} result;
33 {attr} {storage} unsigned {type} i;
34 unsigned {type} result;
38 LOG(("i*3 == 111 = %u\n", (int)(i*3)));
40 ASSERT(result == 111);
43 ASSERT(result == ((unsigned {type})444));
49 {attr} {storage} signed {type} i;
54 LOG(("i*5 == 25 = %u\n", (int)(i*5)));
57 LOG(("i*-4 == -20 = %u\n", (int)(i*-4)));
61 LOG(("i*12 == -120 = %u\n", (int)(i*12)));
63 LOG(("i*-3 == 30 = %u\n", (int)(i*-3)));
74 {attr} {storage} signed {type} i;
77 LOG(("i/5 == 20 = %u\n", (int)i/5));
79 LOG(("i/-4 == -25 = %u\n", (int)i/-4));
84 LOG(("i/25 == -2 = %u\n", (int)i/25));
86 LOG(("i/-12 == 4 = %u\n", (int)i/-12));
95 {attr} {storage} signed {type} i;
97 // Disabled the LOG functions due to a bug in sdcc involving
100 // LOG(("i%%17 == 15 = %u\n", (int)(i%9)));
103 // LOG(("i%%-7 == 2 = %u\n", (int)i%-7));
109 // LOG(("i%%3 == -1 = %u\n", (int)i%3));
111 // LOG(("i%%-5 == -4 = %u\n", (int)i%-5));