1 /* 2 divcmp-2.c from the execute part of the gcc torture tests. 3 */ 4 5 #include <testfwk.h> 6 7 #ifdef __SDCC 8 #pragma std_c99 9 #endif 10 test1(int x)11int test1(int x) 12 { 13 return x/10 == 2; 14 } 15 test2(int x)16int test2(int x) 17 { 18 return x/10 == 0; 19 } 20 test3(int x)21int test3(int x) 22 { 23 return x/10 == -2; 24 } 25 test4(int x)26int test4(int x) 27 { 28 return x/-10 == 2; 29 } 30 test5(int x)31int test5(int x) 32 { 33 return x/-10 == 0; 34 } 35 test6(int x)36int test6(int x) 37 { 38 return x/-10 == -2; 39 } 40 41 void testTortureExecute(void)42testTortureExecute (void) 43 { 44 if (test1(19) != 0) 45 ASSERT (0); 46 if (test1(20) != 1) 47 ASSERT (0); 48 if (test1(29) != 1) 49 ASSERT (0); 50 if (test1(30) != 0) 51 ASSERT (0); 52 53 if (test2(-10) != 0) 54 ASSERT (0); 55 if (test2(-9) != 1) 56 ASSERT (0); 57 if (test2(9) != 1) 58 ASSERT (0); 59 if (test2(10) != 0) 60 ASSERT (0); 61 62 if (test3(-30) != 0) 63 ASSERT (0); 64 if (test3(-29) != 1) 65 ASSERT (0); 66 if (test3(-20) != 1) 67 ASSERT (0); 68 if (test3(-19) != 0) 69 ASSERT (0); 70 71 if (test4(-30) != 0) 72 ASSERT (0); 73 if (test4(-29) != 1) 74 ASSERT (0); 75 if (test4(-20) != 1) 76 ASSERT (0); 77 if (test4(-19) != 0) 78 ASSERT (0); 79 80 if (test5(-10) != 0) 81 ASSERT (0); 82 if (test5(-9) != 1) 83 ASSERT (0); 84 if (test5(9) != 1) 85 ASSERT (0); 86 if (test5(10) != 0) 87 ASSERT (0); 88 89 if (test6(19) != 0) 90 ASSERT (0); 91 if (test6(20) != 1) 92 ASSERT (0); 93 if (test6(29) != 1) 94 ASSERT (0); 95 if (test6(30) != 0) 96 ASSERT (0); 97 98 return; 99 } 100 101