2020-05-20 18:36:25 -04:00
|
|
|
#define NCPP_EXCEPTIONS_PLEASE
|
|
|
|
#include "main.h"
|
2020-10-03 18:54:34 -04:00
|
|
|
#include <memory>
|
2020-05-20 18:36:25 -04:00
|
|
|
|
2020-05-21 17:22:12 -04:00
|
|
|
using namespace ncpp;
|
|
|
|
|
2020-07-09 04:31:59 -04:00
|
|
|
TEST_CASE("Exceptions") {
|
2020-05-21 17:22:12 -04:00
|
|
|
|
2020-07-23 01:56:42 -04:00
|
|
|
notcurses_options nopts{};
|
|
|
|
nopts.flags = NCOPTION_SUPPRESS_BANNERS |
|
|
|
|
NCOPTION_INHIBIT_SETLOCALE;
|
|
|
|
nopts.loglevel = NCLOGLEVEL_VERBOSE;
|
|
|
|
|
2020-07-09 04:31:59 -04:00
|
|
|
SUBCASE("GetInstance") {
|
|
|
|
CHECK_THROWS_AS(NotCurses::get_instance(), invalid_state_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("ResetStats") {
|
2020-07-23 01:56:42 -04:00
|
|
|
NotCurses nc{ nopts };
|
2020-07-09 04:31:59 -04:00
|
|
|
CHECK_THROWS_AS(nc.reset_stats(nullptr), invalid_argument);
|
|
|
|
}
|
2020-05-20 18:36:25 -04:00
|
|
|
|
2020-05-22 03:31:03 -04:00
|
|
|
// ncpp only allows one notcurses object at a time (why?)
|
2020-07-09 04:31:59 -04:00
|
|
|
SUBCASE("OnlyOneNotCurses") {
|
2020-07-23 01:56:42 -04:00
|
|
|
NotCurses nc{ nopts };
|
2020-07-09 04:31:59 -04:00
|
|
|
std::unique_ptr<NotCurses> nc2;
|
|
|
|
// FIXME attempts to match ::init_error have failed thus far :/
|
|
|
|
CHECK_THROWS(nc2.reset(new NotCurses()));
|
|
|
|
}
|
|
|
|
|
2020-05-20 18:36:25 -04:00
|
|
|
}
|