2020-05-20 22:36:25 +00:00
|
|
|
#define NCPP_EXCEPTIONS_PLEASE
|
|
|
|
#include "main.h"
|
|
|
|
|
2020-05-21 21:22:12 +00:00
|
|
|
using namespace ncpp;
|
|
|
|
|
2020-07-09 08:31:59 +00:00
|
|
|
TEST_CASE("Exceptions") {
|
2020-05-21 21:22:12 +00:00
|
|
|
|
2020-07-09 08:31:59 +00:00
|
|
|
SUBCASE("GetInstance") {
|
|
|
|
CHECK_THROWS_AS(NotCurses::get_instance(), invalid_state_error);
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("ResetStats") {
|
|
|
|
NotCurses nc;
|
|
|
|
CHECK_THROWS_AS(nc.reset_stats(nullptr), invalid_argument);
|
|
|
|
}
|
2020-05-20 22:36:25 +00:00
|
|
|
|
2020-05-22 07:31:03 +00:00
|
|
|
// ncpp only allows one notcurses object at a time (why?)
|
2020-07-09 08:31:59 +00:00
|
|
|
SUBCASE("OnlyOneNotCurses") {
|
|
|
|
NotCurses nc;
|
|
|
|
std::unique_ptr<NotCurses> nc2;
|
|
|
|
// FIXME attempts to match ::init_error have failed thus far :/
|
|
|
|
CHECK_THROWS(nc2.reset(new NotCurses()));
|
|
|
|
}
|
|
|
|
|
2020-05-20 22:36:25 +00:00
|
|
|
}
|