blob: c124c0235ebe456a8ec78056ef454b92842157a5 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/*
20071030-1.c from the execute part of the gcc torture suite.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c99
#pragma disable_warning 93
#endif
#include <string.h>
/* PR target/11044 */
/* Originator: Tim McGrath <misty-@charter.net> */
/* Testcase contributed by Eric Botcazou <ebotcazou@libertysurf.fr> */
/* Testcase copied from gcc.target/i386/loop-3.c */
#if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
typedef struct
{
unsigned char colormod;
} entity_state_t;
typedef struct
{
int num_entities;
entity_state_t *entities;
} packet_entities_t;
typedef struct
{
double senttime;
float ping_time;
packet_entities_t entities;
} client_frame_t;
typedef enum
{
cs_free,
cs_server,
cs_zombie,
cs_connected,
cs_spawned
} sv_client_state_t;
typedef struct client_s
{
sv_client_state_t state;
int ping;
client_frame_t frames[64];
} client_t;
int CalcPing (client_t *cl)
{
float ping;
int count, i;
register client_frame_t *frame;
if (cl->state == cs_server)
return cl->ping;
ping = 0;
count = 0;
for (frame = cl->frames, i = 0; i < 64; i++, frame++) {
if (frame->ping_time > 0) {
ping += frame->ping_time;
count++;
}
}
if (!count)
return 9999;
ping /= count;
return ping * 1000;
}
#endif
void testTortureExecute(void)
{
#if !defined(__SDCC_mcs51) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
client_t cl;
memset(&cl, 0, sizeof(cl));
cl.frames[0].ping_time = 1.0f;
if (CalcPing(&cl) != 1000)
ASSERT (0);
return;
#endif
}
|