Add code coverage support. (#378)

This commit is contained in:
Arthur Sonzogni
2022-04-17 15:47:20 +02:00
committed by GitHub
parent b2896aba49
commit 764c24ef40
26 changed files with 206 additions and 96 deletions

View File

@@ -10,7 +10,7 @@
#include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, TEST, EXPECT_EQ
using namespace ftxui;
namespace ftxui {
namespace {
std::string rotate(std::string str) {
@@ -175,7 +175,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_NoFlex) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -203,7 +203,7 @@ TEST(GridboxTest, Vertical_NoFlex_NoFlex_NoFlex) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(1, i);
Render(screen, root);
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
@@ -233,7 +233,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_NoFlex) {
"012 abcABC", //
"012 abcABC", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -261,7 +261,7 @@ TEST(GridboxTest, Vertical_FlexGrow_NoFlex_NoFlex) {
"012 abcABC", //
"012 abcABC", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(1, i);
Render(screen, root);
EXPECT_EQ(expectations[i], rotate(screen.ToString()));
@@ -291,7 +291,7 @@ TEST(GridboxTest, Horizontal_NoFlex_FlexGrow_NoFlex) {
"012abc ABC", //
"012abc ABC", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -321,7 +321,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_FlexGrow) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -353,7 +353,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_FlexGrow) {
"012 abcABC ", //
"012 abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -387,7 +387,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_FlexGrow_FlexGrow) {
"012 abc ABC ", //
"012 abc ABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -419,7 +419,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_NoFlex_NoFlex) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -449,7 +449,7 @@ TEST(GridboxTest, Horizontal_NoFlex_FlexShrink_NoFlex) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -479,7 +479,7 @@ TEST(GridboxTest, Horizontal_NoFlex_NoFlex_FlexShrink) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -508,7 +508,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_NoFlex_FlexShrink) {
"012abcABC", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -539,7 +539,7 @@ TEST(GridboxTest, Horizontal_FlexShrink_FlexShrink_FlexShrink) {
"012abcABC ", //
"012abcABC ", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -570,7 +570,7 @@ TEST(GridboxTest, Horizontal_FlexGrow_NoFlex_FlewShrink) {
"012 abcABC", //
"012 abcABC", //
};
for (int i = 0; i < expectations.size(); ++i) {
for (size_t i = 0; i < expectations.size(); ++i) {
Screen screen(i, 1);
Render(screen, root);
EXPECT_EQ(expectations[i], screen.ToString());
@@ -596,6 +596,8 @@ TEST(GridboxTest, MissingCells) {
" ");
}
} // namespace ftxui
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.