From e87fbb3003193173b4fc9e65d677cf36a7dc2a21 Mon Sep 17 00:00:00 2001 From: nick black Date: Wed, 1 Apr 2020 06:56:34 -0400 Subject: [PATCH] Throw up an ncplot unit test --- tests/plot.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/plot.cpp diff --git a/tests/plot.cpp b/tests/plot.cpp new file mode 100644 index 000000000..2e5a68b1d --- /dev/null +++ b/tests/plot.cpp @@ -0,0 +1,33 @@ +#include "main.h" +#include +#include + +TEST_CASE("Plot") { + if(!enforce_utf8()){ + return; + } + if(getenv("TERM") == nullptr){ + return; + } + notcurses_options nopts{}; + nopts.inhibit_alternate_screen = true; + nopts.suppress_banner = true; + FILE* outfp_ = fopen("/dev/tty", "wb"); + REQUIRE(outfp_); + struct notcurses* nc_ = notcurses_init(&nopts, outfp_); + REQUIRE(nc_); + struct ncplane* n_ = notcurses_stdplane(nc_); + REQUIRE(n_); + REQUIRE(0 == ncplane_cursor_move_yx(n_, 0, 0)); + + SUBCASE("SimplePlot"){ + ncplot_options popts{}; + ncplot* p = ncplot_create(n_, &popts); + REQUIRE(p); + CHECK(n_ == ncplot_plane(p)); + ncplot_destroy(p); + } + + CHECK(0 == notcurses_stop(nc_)); + CHECK(0 == fclose(outfp_)); +}