Skip to content

Commit

Permalink
test create_view with no file provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Ttibsi committed Nov 1, 2024
1 parent dc2ffe2 commit 7b6ccf0
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/controller_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,22 @@ TEST_CASE("get_mode", "[CONTROLLER]") {
REQUIRE(c.get_mode() == "WRITE");
}

// TODO: empty view
TEST_CASE("create_view", "[CONTROLLER]") {
Controller c;
c.create_view("tests/fixture/test_file_1.txt");
SECTION("View with file") {
Controller c;
c.create_view("tests/fixture/test_file_1.txt");

REQUIRE(c.models.size() == 1);
REQUIRE(*c.models.at(0).buf.begin() == 'T');
}

SECTION("Empty view") {
Controller c;
c.create_view("");

REQUIRE(c.models.size() == 1);
REQUIRE(*c.models.at(0).buf.begin() == 'T');
REQUIRE(c.models.size() == 1);
REQUIRE(c.models.at(0).buf.size() == 0);
}
}

TEST_CASE("start_action_engine", "[CONTROLLER]") {
Expand Down

0 comments on commit 7b6ccf0

Please sign in to comment.