blob: 070d7d740f2ea903305a9ef201c46554960ad2e5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
/*
20120427-1.c from the execute part of the gcc torture suite.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c89
#endif
typedef struct sreal
{
unsigned sig; /* Significant. */
int exp; /* Exponent. */
} sreal;
sreal_compare (sreal *a, sreal *b)
{
if (a->exp > b->exp)
return 1;
if (a->exp < b->exp)
return -1;
if (a->sig > b->sig)
return 1;
return -(a->sig < b->sig);
}
sreal a[] = {
{ 0, 0 },
{ 1, 0 },
{ 0, 1 },
{ 1, 1 }
};
void
testTortureExecute (void)
{
int i, j;
for (i = 0; i <= 3; i++) {
for (j = 0; j < 3; j++) {
if (i < j && sreal_compare(&a[i], &a[j]) != -1) ASSERT(0);
if (i == j && sreal_compare(&a[i], &a[j]) != 0) ASSERT(0);
if (i > j && sreal_compare(&a[i], &a[j]) != 1) ASSERT(0);
}
}
}
|