Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oir committed Nov 26, 2023
1 parent afd037b commit 98b239f
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,14 @@ ProgressBar<float> factory_helper<ProgressBar<float>>() {
return ProgressBar(&progress, hide);
}

using DisplayTypeList = std::tuple<Animation, Counter<>, ProgressBar<float>>;
template <>
Composite factory_helper<Composite>() {
static size_t progress;
static std::stringstream hide;
return ProgressBar(&progress, hide) | Counter(&progress, hide);
}

using DisplayTypeList = std::tuple<Animation, Counter<>, ProgressBar<float>, Composite>;

TEMPLATE_LIST_TEST_CASE("Error cases", "[edges]", DisplayTypeList) {
auto orig = factory_helper<TestType>();
Expand All @@ -241,6 +248,27 @@ TEMPLATE_LIST_TEST_CASE("Destroy before done", "[edges]", DisplayTypeList) {
}());
}

TEMPLATE_LIST_TEST_CASE("Copy & move", "[edges]", DisplayTypeList) {
CHECK_NOTHROW([]() {
auto orig = factory_helper<TestType>();
auto copy = orig;
auto moved = std::move(orig);
copy.show();
copy.done();
moved.show();
moved.done();
}());
}

TEMPLATE_LIST_TEST_CASE("Clone", "[edges]", DisplayTypeList) {
CHECK_NOTHROW([]() {
auto orig = factory_helper<TestType>();
auto clone = orig.clone();
clone->show();
clone->done();
}());
}

TEMPLATE_LIST_TEST_CASE("Progress bar", "[bar]", ProgressTypeList) {
std::stringstream out;
TestType progress{0};
Expand Down

0 comments on commit 98b239f

Please sign in to comment.