forked from Neirth/FreeNOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented TAPReporter for outputing TAP formatted test results usin…
…g libtest.
- Loading branch information
1 parent
c31df56
commit f034f59
Showing
14 changed files
with
257 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright (C) 2015 Niek Linnenbank | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include "TAPReporter.h" | ||
|
||
TAPReporter::TAPReporter(int argc, char **argv) | ||
: TestReporter(argc, argv) | ||
{ | ||
m_count = 1; | ||
} | ||
|
||
void TAPReporter::reportBegin(List<TestInstance *> & tests) | ||
{ | ||
printf("1..%d\r\n", tests.count()); | ||
} | ||
|
||
void TAPReporter::reportBefore(TestInstance & test) | ||
{ | ||
} | ||
|
||
void TAPReporter::reportAfter(TestInstance & test, TestResult & result) | ||
{ | ||
#warning TODO: how to get the assertion failure text in the test reporter output???? | ||
|
||
switch (result) | ||
{ | ||
case OK: printf("ok %d %s\r\n", m_count, *test.getName()); break; | ||
case FAIL: printf("not ok %d %s\r\n", m_count, *test.getName()); break; | ||
case SKIP: printf("skip %d %s\r\n", m_count, *test.getName()); break; | ||
} | ||
m_count++; | ||
} | ||
|
||
void TAPReporter::reportFinish(List<TestInstance *> & tests) | ||
{ | ||
#ifdef __HOST__ | ||
fflush(stdout); | ||
#endif /* __HOST__ */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright (C) 2015 Niek Linnenbank | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#ifndef __LIBTEST_TAPREPORTER_H | ||
#define __LIBTEST_TAPREPORTER_H | ||
|
||
#include "TestReporter.h" | ||
|
||
/** | ||
* Output TestResults in TAP format to stdout. | ||
* | ||
* @see https://testanything.org/tap-specification.html | ||
*/ | ||
class TAPReporter : public TestReporter | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
TAPReporter(int argc, char **argv); | ||
|
||
/** | ||
* Report start of testing. | ||
*/ | ||
virtual void reportBegin(List<TestInstance *> & tests); | ||
|
||
/** | ||
* Report start of a test. | ||
*/ | ||
virtual void reportBefore(TestInstance & test); | ||
|
||
/** | ||
* Report finish of a test. | ||
*/ | ||
virtual void reportAfter(TestInstance & test, TestResult & result); | ||
|
||
/** | ||
* Report completion of all tests. | ||
*/ | ||
virtual void reportFinish(List<TestInstance *> & tests); | ||
|
||
private: | ||
|
||
/** Test counter. */ | ||
uint m_count; | ||
}; | ||
|
||
#endif /* __LIBTEST_TAPREPORTER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.