plot unit tests #430

This commit is contained in:
nick black 2020-04-03 01:25:49 -04:00 committed by Nick Black
parent 359303ed83
commit d2fe768c30
2 changed files with 24 additions and 0 deletions

View File

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

View File

@ -20,6 +20,28 @@ TEST_CASE("Plot") {
REQUIRE(n_);
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"){
ncplot_options popts{};
ncplot* p = ncplot_create(n_, &popts);