{
auto scene = Scene::gen();
REQUIRE(scene);
-
- 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
- REQUIRE(scene->push(nullptr) == Result::MemoryCorruption);
-
- //Negative case 2
- std::unique_ptr<Shape> shape = nullptr;
- REQUIRE(scene->push(move(shape)) == Result::MemoryCorruption);
+ 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);
+ }
+
+ SECTION("Pushing Null Pointer") {
+ REQUIRE(scene->push(nullptr) == Result::MemoryCorruption);
+ }
+
+ 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);
- 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("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);
+ }
- REQUIRE(scene->reserve(-1) == Result::FailedAllocation);
+ SECTION("Too Big Size") {
+ REQUIRE(scene->reserve(-1) == Result::FailedAllocation);
+ }
}
TEST_CASE("Scene Clear", "[tvgScene]")