plot unit tests #430

pull/434/head
nick black 5 years ago committed by Nick Black
parent 359303ed83
commit d2fe768c30

@ -11,6 +11,8 @@ int main(void){
} }
std::unique_ptr<ncpp::Plane> n(nc.get_stdplane ()); std::unique_ptr<ncpp::Plane> n(nc.get_stdplane ());
struct ncplot_options popts{}; struct ncplot_options popts{};
popts.rangex = 60;
popts.detectrange = true;
struct ncplot* plot = ncplot_create(*n, &popts); struct ncplot* plot = ncplot_create(*n, &popts);
char32_t r; char32_t r;
ncinput ni; ncinput ni;

@ -20,6 +20,28 @@ TEST_CASE("Plot") {
REQUIRE(n_); REQUIRE(n_);
REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0)); REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0));
// setting detectrange with non-zero domain limits is invalid
SUBCASE("DetectRangeBadY"){
ncplot_options popts{};
popts.detectrange = true;
popts.miny = -1;
ncplot* p = ncplot_create(n_, &popts);
CHECK(nullptr == p);
popts.miny = 0;
popts.maxy = 1;
ncplot* p = ncplot_create(n_, &popts);
CHECK(nullptr == p);
}
// maxy < miny is invalid
SUBCASE("RejectMaxyLessMiny"){
ncplot_options popts{};
popts.miny = 2;
popts.maxy = 1;
ncplot* p = ncplot_create(n_, &popts);
CHECK(nullptr == p);
}
SUBCASE("SimplePlot"){ SUBCASE("SimplePlot"){
ncplot_options popts{}; ncplot_options popts{};
ncplot* p = ncplot_create(n_, &popts); ncplot* p = ncplot_create(n_, &popts);

Loading…
Cancel
Save