@@ -47,10 +47,11 @@ double expected = 0;
4747
4848/* better to schedule by incrementing the `next` timestamp for drift-free timing */
4949/* schedule next periodic event (implicit phase) */
50+ /* also test assigning `t_next` instead of `next` (shouldn't make a difference) */
5051#define NEXT \
5152 "period = %g; " \
5253 "y = 1; " \
53- "next += period;"
54+ "t_next += period;"
5455
5556/* schedule next periodic event (explicit phase)
5657 * we "round up" when calculating num periods since start if closer than 0.999 */
@@ -113,14 +114,15 @@ double expected = 0;
113114 "next = next{-1} + period * 2;"
114115
115116#define QUANTIZE \
116- "period = ema((_t_x-_t_x{-1}) ?: %f * 25, 0.2); " \
117+ "period = ema((_t_x-_t_x{-1}) ?: %g * 25, 0.2); " \
117118 "y = period; " \
118119 "next += period;"
119120
120121#define RANDOM \
121122 "p = %g; " \
122123 "r = uniform(p) + p * 0.5; "\
123- "y = r; next += r;"
124+ "y = r;" \
125+ "next += r;"
124126
125127//"new{-1}=0; period = ema(new?0.1:(t_x')
126128
@@ -177,15 +179,15 @@ test_config test_configs[] = {
177179 { 17 , PAST , MPR_LOC_SRC , 0.00 , 0.05 },
178180 { 18 , PAST , MPR_LOC_DST , 0.00 , 0.05 },
179181 { 19 , FUTURE , MPR_LOC_SRC , 1.95 , 2.05 },
180- { 20 , FUTURE , MPR_LOC_DST , 1.95 , 2.05 },
182+ { 20 , FUTURE , MPR_LOC_DST , 1.90 , 2.05 },
181183 { 21 , UPSAMPLE , MPR_LOC_SRC , 0.65 , 0.70 },
182184 { 22 , UPSAMPLE , MPR_LOC_DST , 0.65 , 0.70 },
183185 { 23 , DOWNSAMPLE , MPR_LOC_SRC , 1.95 , 2.05 },
184186 { 24 , DOWNSAMPLE , MPR_LOC_DST , 1.95 , 2.05 },
185187 { 25 , QUANTIZE , MPR_LOC_SRC , 1.65 , 1.90 },
186188 { 26 , QUANTIZE , MPR_LOC_DST , 1.65 , 1.90 },
187- { 27 , RANDOM , MPR_LOC_SRC , 0.75 , 1.25 },
188- { 28 , RANDOM , MPR_LOC_DST , 0.75 , 1.25 },
189+ { 27 , RANDOM , MPR_LOC_SRC , 0.50 , 1.50 },
190+ { 28 , RANDOM , MPR_LOC_DST , 0.50 , 1.50 },
189191 { 29 , FN_PERIODIC , MPR_LOC_SRC , 0.95 , 1.15 },
190192 { 30 , FN_PERIODIC , MPR_LOC_DST , 0.95 , 1.15 },
191193 { 31 , FN_PERIODIC_FUTURE , MPR_LOC_SRC , 1.95 , 2.05 },
@@ -337,6 +339,7 @@ int run_test(test_config *config)
337339 mpr_map map ;
338340 char expr [256 ];
339341
342+ /* insert period value into expression string if specified */
340343 snprintf (expr , 256 , config -> expr , period_sec );
341344
342345 printf ("Configuration %d: " , config -> test_id );
0 commit comments