Lines Matching +full:- +full:c
1 /* Copyright (c) 2016-2018 the Civetweb developers
34 #pragma GCC diagnostic ignored "-Wunused-function"
40 #include "../src/civetweb.c"
53 (*p)--; in action_dec()
55 if (*p < -1) { in action_dec()
60 return (*p >= -3) ? action_dec_ret : 0; in action_dec()
68 (*p)--; in action_dec_to_0()
70 if (*p <= -1) { in action_dec_to_0()
82 int c[10]; in START_TEST() local
84 memset(c, 0, sizeof(c)); in START_TEST()
93 c[0] = 100; in START_TEST()
94 timer_add(&ctx, 0.05, 0.1, 1, action_dec, c + 0); in START_TEST()
95 c[2] = 20; in START_TEST()
96 timer_add(&ctx, 0.25, 0.5, 1, action_dec, c + 2); in START_TEST()
97 c[1] = 50; in START_TEST()
98 timer_add(&ctx, 0.1, 0.2, 1, action_dec, c + 1); in START_TEST()
102 mg_sleep(10000); /* Sleep 10 second - timers will run */ in START_TEST()
108 mg_sleep(2000); /* Sleep 2 second - timers will not run */ in START_TEST()
120 ck_assert_int_ge(c[0], -1); in START_TEST()
121 ck_assert_int_le(c[0], +1); in START_TEST()
122 ck_assert_int_ge(c[1], -1); in START_TEST()
123 ck_assert_int_le(c[1], +1); in START_TEST()
124 ck_assert_int_ge(c[2], -1); in START_TEST()
125 ck_assert_int_le(c[2], +1); in START_TEST()
133 int c[10]; in START_TEST() local
135 memset(c, 0, sizeof(c)); in START_TEST()
144 c[0] = 10; in START_TEST()
145 timer_add(&ctx, 0, 0.1, 1, action_dec, c + 0); in START_TEST()
146 c[2] = 2; in START_TEST()
147 timer_add(&ctx, 0, 0.5, 1, action_dec, c + 2); in START_TEST()
148 c[1] = 5; in START_TEST()
149 timer_add(&ctx, 0, 0.2, 1, action_dec, c + 1); in START_TEST()
153 mg_sleep(1000); /* Sleep 1 second - timer will run */ in START_TEST()
159 mg_sleep(1000); /* Sleep 1 second - timer will not run */ in START_TEST()
168 ck_assert_int_eq(c[0], 9); in START_TEST()
169 ck_assert_int_eq(c[1], 4); in START_TEST()
170 ck_assert_int_eq(c[2], 1); in START_TEST()
178 int c[10]; in START_TEST() local
180 memset(c, 0, sizeof(c)); in START_TEST()
189 c[0] = 10; in START_TEST()
190 timer_add(&ctx, 0, 0, 1, action_dec, c + 0); in START_TEST()
191 c[2] = 2; in START_TEST()
192 timer_add(&ctx, 0, 0, 1, action_dec, c + 2); in START_TEST()
193 c[1] = 5; in START_TEST()
194 timer_add(&ctx, 0, 0, 1, action_dec, c + 1); in START_TEST()
198 mg_sleep(1000); /* Sleep 1 second - timer will run */ in START_TEST()
204 mg_sleep(1000); /* Sleep 1 second - timer will not run */ in START_TEST()
213 ck_assert_int_eq(c[0], 9); in START_TEST()
214 ck_assert_int_eq(c[1], 4); in START_TEST()
215 ck_assert_int_eq(c[2], 1); in START_TEST()
223 int c[10]; in START_TEST() local
225 memset(c, 0, sizeof(c)); in START_TEST()
232 /* 3 --> 2, because it is a single shot timer */ in START_TEST()
233 c[0] = 3; in START_TEST()
234 timer_add(&ctx, 0, 0, 1, action_dec_to_0, &c[0]); in START_TEST()
236 /* 3 --> 0, because it will run until c[1] = 0 and then stop */ in START_TEST()
237 c[1] = 3; in START_TEST()
238 timer_add(&ctx, 0, 0.2, 1, action_dec_to_0, &c[1]); in START_TEST()
240 /* 3 --> 1, with 750 ms period, it will run once at start, in START_TEST()
243 c[2] = 3; in START_TEST()
244 timer_add(&ctx, 0, 0.75, 1, action_dec_to_0, &c[2]); in START_TEST()
246 /* 3 --> 2, will run at start, but no cyclic in 1 second */ in START_TEST()
247 c[3] = 3; in START_TEST()
248 timer_add(&ctx, 0, 2.5, 1, action_dec_to_0, &c[3]); in START_TEST()
250 /* 3 --> 3, will not run at start */ in START_TEST()
251 c[4] = 3; in START_TEST()
252 timer_add(&ctx, 2.5, 0.1, 1, action_dec_to_0, &c[4]); in START_TEST()
254 /* 3 --> 2, an absolute timer in the past (-123.456) will still in START_TEST()
256 c[5] = 3; in START_TEST()
257 timer_add(&ctx, -123.456, 2.5, 0, action_dec_to_0, &c[5]); in START_TEST()
259 /* 3 --> 1, an absolute timer in the past (-123.456) will still in START_TEST()
261 c[6] = 3; in START_TEST()
262 timer_add(&ctx, -123.456, 0.75, 0, action_dec_to_0, &c[6]); in START_TEST()
266 mg_sleep(1000); /* Sleep 1 second - timer will run */ in START_TEST()
272 mg_sleep(1000); /* Sleep 1 second - timer will not run */ in START_TEST()
281 ck_assert_int_eq(c[0], 2); in START_TEST()
282 ck_assert_int_eq(c[1], 0); in START_TEST()
283 ck_assert_int_eq(c[2], 1); in START_TEST()
284 ck_assert_int_eq(c[3], 2); in START_TEST()
285 ck_assert_int_eq(c[4], 3); in START_TEST()
286 ck_assert_int_eq(c[5], 2); in START_TEST()
287 ck_assert_int_eq(c[6], 1); in START_TEST()