test Scene: Separate tests into SECTION()

Split some tests into SECTIONs based on their type.
This improves the readability of TC.

And developer can run test in SECTION unit.
ex)
./build/test/tvgUnitTests "Pushing Paints Into Scene" -c "Pushing Null Pointer"
This commit is contained in:
JunsuChoi 2021-06-18 15:40:15 +09:00 committed by Hermet Park
parent 8bb10fb261
commit f4895459fa

View file

@ -35,31 +35,38 @@ TEST_CASE("Pushing Paints Into Scene", "[tvgScene]")
{
auto scene = Scene::gen();
REQUIRE(scene);
SECTION("Pushing Paints") {
REQUIRE(scene->push(move(Shape::gen())) == Result::Success);
REQUIRE(scene->push(move(Picture::gen())) == Result::Success);
REQUIRE(scene->push(move(Scene::gen())) == Result::Success);
}
//Negative case 1
SECTION("Pushing Null Pointer") {
REQUIRE(scene->push(nullptr) == Result::MemoryCorruption);
}
//Negative case 2
SECTION("Pushing Invalid Object") {
std::unique_ptr<Shape> shape = nullptr;
REQUIRE(scene->push(move(shape)) == Result::MemoryCorruption);
}
}
TEST_CASE("Scene Memory Reservation", "[tvgScene]")
{
auto scene = Scene::gen();
REQUIRE(scene);
SECTION("Check Growth / Reduction") {
REQUIRE(scene->reserve(10) == Result::Success);
REQUIRE(scene->reserve(1000) == Result::Success);
REQUIRE(scene->reserve(100) == Result::Success);
REQUIRE(scene->reserve(0) == Result::Success);
}
SECTION("Too Big Size") {
REQUIRE(scene->reserve(-1) == Result::FailedAllocation);
}
}
TEST_CASE("Scene Clear", "[tvgScene]")
{