two more test cases concering Convs and Divs
[libfirm] / ir / be / test / divs.c
1 int x = 42;
2 int y = 10;
3
4 int signed_div(int x, int y) {
5         printf("%d (should be 4)\n", x / y);
6         printf("%d (should be 2)\n", x % y);
7         return (x / y) + (x % y);
8 }
9
10 unsigned int unsigned_div(unsigned int x, unsigned int y) {
11         printf("%u (should be 4)\n", x / y);
12         printf("%u (should be 2)\n", x % y);
13         return (x / y) + (x % y);
14 }
15
16 double f_div(double x, double y) {
17         printf("%f (should be 4.2)\n", x / y);
18         return (x / y);
19 }
20
21 int main(void) {
22         int x = signed_div(42, 10)
23                         + unsigned_div(42, 10)
24                         + f_div(42.0, 10.0);
25         return 16-x;
26 }