Skip to content
Snippets Groups Projects
Commit f2ba32d2 authored by Timon Habenicht's avatar Timon Habenicht
Browse files

new FinalTestOutput

parent 75ef201c
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,8 @@ class TestCout
public:
virtual void makeTestOutput(bool testPassed, std::string testName, int l1, int l2, std::string nameWerte1, std::string nameWerte2, std::string nameWerte3, double testWert1, double testWert2, double testWert3) = 0;
virtual void makeSimulationHeadOutput(std::string simName, int l) = 0;
virtual void makeFinalTestOutput(int numberOfPassedTests, int numberOfTests) = 0;
virtual void makeFinalTestOutputHead(int numberOfPassedTests, int numberOfTests) = 0;
virtual void makeFinalTestOutputFoot(int numberOfPassedTests, int numberOfTests) = 0;
private:
};
#endif
\ No newline at end of file
......@@ -55,17 +55,19 @@ void TestCoutImp::makeSimulationHeadOutput(std::string simName, int l)
printGreenHashLine();
}
void TestCoutImp::makeFinalTestOutput(int numberOfPassedTests, int numberOfTests)
void TestCoutImp::makeFinalTestOutputFoot(int numberOfPassedTests, int numberOfTests)
{
setColor(numberOfPassedTests == numberOfTests);
testing::internal::ColoredPrintf(color, "[----------]\n[----------]");
testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, "Test Summary\n");
testing::internal::ColoredPrintf(color, "[----------]");
printTestPassed(numberOfPassedTests, numberOfTests);
printLine();
}
std::ostringstream info;
info << numberOfPassedTests << " out of " << numberOfTests << " tests passed";
testing::internal::ColoredPrintf(testing::internal::COLOR_DEFAULT, info.str().c_str());
testing::internal::ColoredPrintf(color, "\n[----------]\n\n");
void TestCoutImp::makeFinalTestOutputHead(int numberOfPassedTests, int numberOfTests)
{
setColor(numberOfPassedTests == numberOfTests);
printLine();
printTestPassed(numberOfPassedTests, numberOfTests);
std::cout << std::endl;
}
void TestCoutImp::printTestStart()
......@@ -106,6 +108,21 @@ void TestCoutImp::setColor(bool testPassed)
color = testing::internal::COLOR_RED;
}
void TestCoutImp::printTestPassed(int numberOfPassedTests, int numberOfTests)
{
std::ostringstream test;
test << "[----------]" << std::endl;
test << "[----------] Test Summary" << std::endl;
test << "[----------] " << numberOfPassedTests << " out of " << numberOfTests << " tests passed" << std::endl;
test << "[----------]" << std::endl;
testing::internal::ColoredPrintf(color, test.str().c_str());
}
void TestCoutImp::printLine()
{
testing::internal::ColoredPrintf(color, "----------------------------------------------------------------------\n");
}
void TestCoutImp::printGreen(std::string output)
{
testing::internal::ColoredPrintf(testing::internal::COLOR_GREEN, output.c_str());
......
......@@ -35,7 +35,8 @@ public:
void makeTestOutput(bool testPassed, std::string testName, int l1, int l2, std::string nameWerte1, std::string nameWerte2, std::string nameWerte3, double testWert1, double testWert2, double testWert3);
void makeSimulationHeadOutput(std::string simName, int l);
void makeFinalTestOutput(int numberOfPassedTests, int numberOfTests);
void makeFinalTestOutputHead(int numberOfPassedTests, int numberOfTests);
void makeFinalTestOutputFoot(int numberOfPassedTests, int numberOfTests);
private:
TestCoutImp() {};
......@@ -43,6 +44,8 @@ private:
void printTestEnd(bool testPassed);
void print(std::string output);
void setColor(bool testPassed);
void printTestPassed(int numberOfPassedTests, int numberOfTests);
void printLine();
void printGreen(std::string output);
void printGreenHashLine();
......
......@@ -44,11 +44,11 @@ void TestInformationImp::writeLogFile()
void TestInformationImp::makeFinalTestOutput()
{
colorOutput->makeFinalTestOutput(getNumberOfPassedTests(),getNumberOfTests());
colorOutput->makeFinalTestOutputHead(getNumberOfPassedTests(),getNumberOfTests());
for (int i = 0; i < testResults.size(); i++) {
testResults.at(i)->makeFinalOutput();
}
colorOutput->makeFinalTestOutput(getNumberOfPassedTests(), getNumberOfTests());
colorOutput->makeFinalTestOutputFoot(getNumberOfPassedTests(), getNumberOfTests());
}
void TestInformationImp::setLogFilePath(std::string aLogFilePath)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment