-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
303 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#ifndef TESTLOGGER_H | ||
#define TESTLOGGER_H | ||
|
||
#include <iostream> | ||
#include "colorer/common/Logger.h" | ||
|
||
class TestLogger : public Logger | ||
{ | ||
public: | ||
static constexpr std::string_view LogLevelStr[] {"off", "error", "warning", "info", "debug", "trace"}; | ||
|
||
TestLogger() { current_level = LogLevel::LOG_WARN; } | ||
|
||
~TestLogger() override = default; | ||
|
||
void log(Logger::LogLevel level, const char* /*filename_in*/, int /*line_in*/, const char* /*funcname_in*/, | ||
const char* message) override | ||
{ | ||
if (level > current_level) { | ||
return; | ||
} | ||
log_messages.push_back(message); | ||
//std::cerr << message << '\n'; | ||
} | ||
|
||
bool message_exists() const { return !log_messages.empty(); } | ||
bool message_print(bool waiting_exist = false) const | ||
{ | ||
if (!waiting_exist && message_exists()) { | ||
print_messages(); | ||
} | ||
return !log_messages.empty(); | ||
} | ||
void clean_messages() { log_messages.clear(); } | ||
void print_messages() const | ||
{ | ||
for (const auto& msg : log_messages) { | ||
std::cerr << msg << '\n'; | ||
} | ||
} | ||
|
||
std::vector<std::string> log_messages; | ||
|
||
private: | ||
Logger::LogLevel current_level = Logger::LOG_OFF; | ||
}; | ||
|
||
#endif // TESTLOGGER_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE catalog [ | ||
<!ENTITY hrd "jar:common-allpacked.zip!hrd"> | ||
<!ENTITY catalog-console SYSTEM "jar:$CUR_DIR/data/common-allpacked.zip!hrd/catalog-console.xml"> | ||
]> | ||
<catalog xmlns="http://colorer.github.io/schema/v1/catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.github.io/schema/v1/catalog https://colorer.github.io/schema/v1/catalog.xsd"> | ||
<hrc-sets> | ||
<location link="jar:common.zip!hrc/proto.hrc" /> | ||
<location link="auto" /> | ||
</hrc-sets> | ||
<hrd-sets> | ||
&catalog-console; | ||
</hrd-sets> | ||
</catalog> |
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE catalog [ | ||
<!ENTITY hrd "jar:common-allpacked.zip!hrd"> | ||
<!ENTITY catalog-console SYSTEM "jar:common-allpacked.zip!hrd/catalog-console.xml"> | ||
]> | ||
<catalog xmlns="http://colorer.github.io/schema/v1/catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.github.io/schema/v1/catalog https://colorer.github.io/schema/v1/catalog.xsd"> | ||
<hrc-sets> | ||
<location link="jar:common.zip!hrc/proto.hrc" /> | ||
<location link="auto" /> | ||
</hrc-sets> | ||
<hrd-sets> | ||
&catalog-console; | ||
</hrd-sets> | ||
</catalog> |
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE catalog [ | ||
<!ENTITY hrd "hrd"> | ||
<!ENTITY catalog-console SYSTEM "env:$CUR_DIR/data/hrd/catalog-console.xml"> | ||
]> | ||
<catalog xmlns="http://colorer.github.io/schema/v1/catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.github.io/schema/v1/catalog https://colorer.github.io/schema/v1/catalog.xsd"> | ||
<hrc-sets> | ||
<location link="hrc/proto.hrc" /> | ||
<location link="hrc/auto" /> | ||
</hrc-sets> | ||
<hrd-sets> | ||
&catalog-console; | ||
</hrd-sets> | ||
</catalog> |
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE catalog [ | ||
<!ENTITY hrd "hrd"> | ||
<!ENTITY catalog-console SYSTEM "hrd/catalog-console.xml"> | ||
]> | ||
<catalog xmlns="http://colorer.github.io/schema/v1/catalog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://colorer.github.io/schema/v1/catalog https://colorer.github.io/schema/v1/catalog.xsd"> | ||
<hrc-sets> | ||
<location link="hrc/proto.hrc" /> | ||
<location link="hrc/auto" /> | ||
</hrc-sets> | ||
<hrd-sets> | ||
&catalog-console; | ||
</hrd-sets> | ||
</catalog> |
Binary file not shown.
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,3 @@ | ||
<hrd class="console" name="default" description="Aqua on blue"> | ||
<location link="&hrd;/console/default.hrd"/> | ||
</hrd> |
Empty file.
Empty file.
Empty file.
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,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<hrc> | ||
<prototype name="cue" group="other" description="Cue sheet"> | ||
<filename>/\.cue$/</filename> | ||
<parameters> | ||
<param value='1' description="lines for 'firstline'"/> | ||
<param name='firstlinebytes' value='5' description="bytes for 'firstline'"/> | ||
</parameters> | ||
</prototype> | ||
<type name="cue"> | ||
</type> | ||
</hrc> |
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,8 @@ | ||
#ifndef TEST_COMMON_H | ||
#define TEST_COMMON_H | ||
|
||
#include "TestLogger.h" | ||
|
||
extern std::unique_ptr<TestLogger> logger; | ||
|
||
#endif //TEST_COMMON_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
#define CATCH_CONFIG_MAIN | ||
|
||
#include <catch2/catch.hpp> | ||
#include "colorer/Common.h" | ||
#include "test_common.h" | ||
|
||
std::unique_ptr<TestLogger> logger; | ||
|
||
|
||
TEST_CASE("All test cases reside in other .cpp files") { | ||
|
||
TEST_CASE("All test cases reside in other .cpp files") | ||
{ | ||
logger = std::make_unique<TestLogger>(); | ||
Log::registerLogger(*logger); | ||
} |
Oops, something went wrong.