#include "set_plot.h" #include #include #include int main(void) { double output[5] = {0, 0, 0, 0, 12345}; const double zoom[] = {0, 0, 1, 1, 2, 1, 0, 0, .25, .5}; const double y[] = {15, 10, 30, 1}; const double drag[] = {0, 100, 500, -10, 10, 1}; double back[4], bad[] = {NAN, 10, 8}; assert(set_plot_abi_version() == 1); assert(set_plot_eval(SET_PLOT_TRANSFORM, zoom, 10, output, 4) == 4); assert(output[0] == .125 && output[1] == 0 && output[2] == .5 && output[3] == 1); assert(output[4] == 12345); assert(set_plot_eval(SET_PLOT_TRANSFORM, zoom, 10, output, 3) == 0); assert(set_plot_eval(SET_PLOT_TRANSFORM, zoom, 9, output, 4) == 0); assert(set_plot_eval(999, zoom, 10, output, 4) == 0); assert(set_plot_eval(SET_PLOT_FRACTION, NULL, 4, output, 4) == 0); assert(set_plot_eval(SET_PLOT_FRACTION, y, 4, NULL, 4) == 0); assert(set_plot_eval(SET_PLOT_AXIS, bad, 3, output, 4) == 0); assert(set_plot_eval(SET_PLOT_FRACTION, y, 4, output, 4) == 1); assert(output[0] == .75); back[0] = output[0]; back[1] = y[1]; back[2] = y[2]; back[3] = y[3]; assert(set_plot_eval(SET_PLOT_VALUE, back, 4, output, 4) == 1); assert(output[0] == y[0]); assert(set_plot_eval(SET_PLOT_DRAG, drag, 6, output, 4) == 1); assert(output[0] == -4); puts("shared plot: OK"); return 0; }