Merge remote-tracking branch 'origin/codex/trend-display-scale' into HEAD
This commit is contained in:
2
c/set-protocol/tests/fixtures/plot-v1.json
vendored
2
c/set-protocol/tests/fixtures/plot-v1.json
vendored
@@ -23,6 +23,8 @@
|
||||
{"name":"db_gain","op":7,"input":[1,10],"output":[20]},
|
||||
{"name":"db_attenuation","op":7,"input":[10,1],"output":[-20]},
|
||||
{"name":"db_zero_reference","op":7,"input":[0,1],"output":null},
|
||||
{"name":"absolute_limits","op":8,"input":[0,500,-2,2],"output":[0,500,-2,2]},
|
||||
{"name":"reversed_x_limits","op":8,"input":[1,1,-2,2],"output":null},
|
||||
{"name":"zero_range","op":2,"input":[1,1,1,0],"output":null},
|
||||
{"name":"zero_pixels","op":4,"input":[0,1,0,0,1,0],"output":null},
|
||||
{"name":"bad_viewport","op":0,"input":[0,0,0,1,2,1,0,0,0.5,0.5],"output":null}
|
||||
|
||||
@@ -26,6 +26,13 @@ int main(void) {
|
||||
assert(output[0] == y[0]);
|
||||
assert(set_plot_eval(SET_PLOT_DRAG, drag, 6, output, 4) == 1);
|
||||
assert(output[0] == -4);
|
||||
{
|
||||
const double limits[] = {0, 500, -2, 2};
|
||||
const double reversed[] = {1, 1, -2, 2};
|
||||
assert(set_plot_eval(SET_PLOT_LIMITS, limits, 4, output, 4) == 4);
|
||||
assert(output[0] == 0 && output[1] == 500 && output[2] == -2 && output[3] == 2);
|
||||
assert(set_plot_eval(SET_PLOT_LIMITS, reversed, 4, output, 4) == 0);
|
||||
}
|
||||
puts("shared plot: OK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,15 @@ int main(void)
|
||||
assert(set_spectrum_analyze(times, values, 32, 32, 0, SET_FILTER_LOW_PASS, 0, 16, 1, output, 17, meta) == SET_SPECTRUM_CUTOFF);
|
||||
times[12] = times[11];
|
||||
assert(set_spectrum_analyze(times, values, 32, 32, 0, 0, 0, 0, 1, output, 17, meta) == SET_SPECTRUM_TIMING);
|
||||
{
|
||||
const double amplitudes[] = {10.0, .01, .02, .8, .03, .4, .02};
|
||||
const double noise[] = {0, .10, .12, .11, .09, .10};
|
||||
double scratch[6], peak[2];
|
||||
assert(set_spectrum_dominant_peak(amplitudes, 7, 5, 3, 1e-6, scratch, 6, peak, 2) == 1);
|
||||
assert(peak[0] == 15 && peak[1] == .8);
|
||||
assert(set_spectrum_dominant_peak(noise, 6, 1, 3, 1e-6, scratch, 6, peak, 2) == 0);
|
||||
assert(set_spectrum_dominant_peak(amplitudes, 7, 0, 3, 1e-6, scratch, 6, peak, 2) == -1);
|
||||
}
|
||||
puts("shared spectrum: OK");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,11 @@ int main(void)
|
||||
assert(!set_trend_watch_ack(expected, 4, 1000, 3));
|
||||
const uint8_t packet[] = {1, 2, 3, 4, 2, 0, 52, 18, 255, 255};
|
||||
uint16_t words[64];
|
||||
uint32_t timestamp = 0;
|
||||
assert(set_trend_watch_values(packet, sizeof(packet), words, 64) == 2);
|
||||
assert(words[0] == 0x1234 && words[1] == 0xFFFF);
|
||||
assert(set_trend_watch_decode(packet, sizeof(packet), ×tamp, words, 64) == 2);
|
||||
assert(timestamp == 0x04030201UL);
|
||||
assert(set_trend_watch_values(packet, sizeof(packet) - 1, words, 64) == -1);
|
||||
assert(set_trend_watch_values(packet, sizeof(packet), words, 1) == -1);
|
||||
puts("Shared trend tests passed");
|
||||
|
||||
Reference in New Issue
Block a user