From fc2dc68619750121835e3962c6ddd770e73a69d3 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 3 Apr 2020 04:51:04 -0400 Subject: [PATCH] AugmentCycle2 Unit Test #430 --- tests/plot.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/plot.cpp b/tests/plot.cpp index 0ef10ebc0..ae79b0309 100644 --- a/tests/plot.cpp +++ b/tests/plot.cpp @@ -75,6 +75,36 @@ TEST_CASE("Plot") { ncplot_add_sample(p, 4, 6); CHECK(6 == p->slots[4]); CHECK(2 == p->slots[0]); + CHECK(0 == p->slotx); + ncplot_destroy(p); + } + + // 2-ary slot space with window movement + SUBCASE("AugmentCycle2"){ + ncplot_options popts{}; + popts.rangex = 2; + popts.maxy = 10; + popts.miny = 0; + ncplot* p = ncplot_create(n_, &popts); + REQUIRE(p); + CHECK(0 == p->slots[0]); + ncplot_add_sample(p, 0, 1); + CHECK(1 == p->slots[0]); + ncplot_add_sample(p, 0, 1); + CHECK(2 == p->slots[0]); + ncplot_set_sample(p, 1, 5); + CHECK(5 == p->slots[1]); + ncplot_set_sample(p, 2, 9); + CHECK(5 == p->slots[1]); + CHECK(9 == p->slots[0]); + ncplot_add_sample(p, 3, 4); + CHECK(9 == p->slots[0]); + CHECK(4 == p->slots[1]); + CHECK(2 == p->slotx); + ncplot_add_sample(p, 5, 1); + CHECK(0 == p->slots[0]); + CHECK(1 == p->slots[1]); + CHECK(4 == p->slotx); ncplot_destroy(p); }