ncplot: fix unit tests following #457 (#464)

This commit is contained in:
nick black 2020-04-10 11:22:26 -04:00
parent 89809d5b59
commit e005940acf
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 13 additions and 10 deletions

View File

@ -1,7 +1,11 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 1.2.6 (not yet released)
* 1.2.7 (not yet released)
* Plots now always keep the most recent data to their far right (i.e., the
gap that is initially filled is on the left, rather than the right).
* 1.2.6
* `ncplane_putsimple_yx()` and `ncplane_putstr_yx()` have been exported as
static inline functions.
* `ncplane_set_scrolling()` has been added, allowing control over whether a
@ -21,6 +25,7 @@ rearrangements of Notcurses.
have been read to suggest otherwise. If you're in a long block on input, and
get an `NCKEY_RESIZE`, just call `notcurses_refresh()` (which now calls
`notcurses_resize()` internally, as `notcurses_render()` always has).
* First Fedora packaging.
* 1.2.5
* Add ncplot, with support for sliding-windowed horizontal histograms.

View File

@ -79,7 +79,7 @@ TEST_CASE("Plot") {
CHECK(0 == ncplot_add_sample(p, 4, 6));
CHECK(6 == p->slots[4]);
CHECK(2 == p->slots[0]);
CHECK(0 == p->slotx);
CHECK(4 == p->slotx);
ncplot_destroy(p);
}
@ -104,11 +104,11 @@ TEST_CASE("Plot") {
CHECK(0 == ncplot_add_sample(p, 3, 4));
CHECK(9 == p->slots[0]);
CHECK(4 == p->slots[1]);
CHECK(2 == p->slotx);
CHECK(3 == p->slotx);
CHECK(0 == ncplot_add_sample(p, 5, 1));
CHECK(0 == p->slots[0]);
CHECK(1 == p->slots[1]);
CHECK(4 == p->slotx);
CHECK(1 == p->slots[0]);
CHECK(0 == p->slots[1]);
CHECK(5 == p->slotx);
ncplot_destroy(p);
}
@ -129,17 +129,15 @@ TEST_CASE("Plot") {
}
CHECK(4 == p->slots[4]);
CHECK(0 == ncplot_add_sample(p, 10, 5));
fprintf(stderr, "SLOT 0: %ju\n", p->slots[0]);
CHECK(5 == p->slots[0]);
for(int x = 1 ; x < 4 ; ++x){
fprintf(stderr, "SLOT %d: %ju\n", x, p->slots[x]);
CHECK(0 == p->slots[x]);
}
CHECK(0 == ncplot_add_sample(p, 24, 7));
for(int x = 0 ; x < 4 ; ++x){
CHECK(7 == p->slots[0]);
for(int x = 1 ; x < 5 ; ++x){
CHECK(0 == p->slots[x]);
}
CHECK(7 == p->slots[4]);
CHECK(0 == ncplot_add_sample(p, 100, 0));
for(int x = 0 ; x < 5 ; ++x){
CHECK(0 == p->slots[x]);