struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / mulextra.c.in
blob2e3adb138aa01ef56d601c3c1396d53406c89107
1 /** Simple test for special multiplication support (wide x narrow)
3 type: unsigned char, signed char, unsigned int, signed int
4 */
5 #include <testfwk.h>
7 unsigned long long ull;
8 unsigned long l;
10 void f(void)
12 ull = (unsigned long long)l * 10;
15 {type} c;
17 void g(void)
19 ull = (unsigned long long)l * c;
22 void
23 testMul (void)
25 l = 10ull;
26 c = 10;
27 f();
28 ASSERT (ull == 10ull * ({type})10);
29 g();
30 ASSERT (ull == 10ull * ({type})10);
32 l = 100;
33 c = 10;
34 f();
35 ASSERT (ull == 100ull * ({type})10);
36 g();
37 ASSERT (ull == 100ull * ({type})10);
39 l = 1000ull;
40 c = 10;
41 f();
42 ASSERT (ull == 1000ull * ({type})10);
43 g();
44 ASSERT (ull == 1000ull * ({type})10);
46 l = 10000ull;
47 c = 10;
48 f();
49 ASSERT (ull == 10000ull * ({type})10);
50 g();
51 ASSERT (ull == 10000ull * ({type})10);
53 l = 100000ull;
54 c = 10;
55 f();
56 ASSERT (ull == 100000ull * ({type})10);
57 g();
58 ASSERT (ull == 100000ull * ({type})10);
60 l = 100000ull;
61 c = 100;
62 g();
63 ASSERT (ull == 100000ull * ({type})100);
65 l = 100000ull;
66 c = 1000;
67 g();
68 ASSERT (ull == 100000ull * ({type})1000);