diff options
| author | Martin Hořeňovský | 2021-10-09 00:02:30 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-10-09 00:02:30 +0200 |
| commit | 1d9696d22d4a33b106dee1e3f69cb310d855b637 (patch) | |
| tree | 90f52137016e84648a932537364bdaa3d642ba8d /src/catch2 | |
| parent | ed1f343a41ef9b0db576971f86ccd384bdbaa5d8 (diff) | |
| download | catch3-1d9696d22d4a33b106dee1e3f69cb310d855b637.tar.gz | |
Cleanup reporting of rng seed in existing reporters
Diffstat (limited to 'src/catch2')
| -rw-r--r-- | src/catch2/reporters/catch_reporter_console.cpp | 3 | ||||
| -rw-r--r-- | src/catch2/reporters/catch_reporter_junit.cpp | 12 | ||||
| -rw-r--r-- | src/catch2/reporters/catch_reporter_xml.cpp | 9 |
3 files changed, 9 insertions, 15 deletions
diff --git a/src/catch2/reporters/catch_reporter_console.cpp b/src/catch2/reporters/catch_reporter_console.cpp index d7c2dd59..5c8b6ec7 100644 --- a/src/catch2/reporters/catch_reporter_console.cpp +++ b/src/catch2/reporters/catch_reporter_console.cpp @@ -520,8 +520,7 @@ void ConsoleReporter::lazyPrintRunInfo() { << " is a Catch v" << libraryVersion() << " host application.\n" << "Run with -? for options\n\n"; - if (m_config->rngSeed() != 0) - stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; currentTestRunInfo.used = true; } diff --git a/src/catch2/reporters/catch_reporter_junit.cpp b/src/catch2/reporters/catch_reporter_junit.cpp index b923aee6..8e8da3ca 100644 --- a/src/catch2/reporters/catch_reporter_junit.cpp +++ b/src/catch2/reporters/catch_reporter_junit.cpp @@ -114,19 +114,17 @@ namespace Catch { xml.writeAttribute( "time"_sr, suiteTime ); xml.writeAttribute( "timestamp"_sr, getCurrentTimestamp() ); - // Write properties if there are any - if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + // Write properties + { auto properties = xml.scopedElement("properties"); + xml.scopedElement("property") + .writeAttribute("name"_sr, "random-seed"_sr) + .writeAttribute("value"_sr, m_config->rngSeed()); if (m_config->hasTestFilters()) { xml.scopedElement("property") .writeAttribute("name"_sr, "filters"_sr) .writeAttribute("value"_sr, serializeFilters(m_config->getTestsOrTags())); } - if (m_config->rngSeed() != 0) { - xml.scopedElement("property") - .writeAttribute("name"_sr, "random-seed"_sr) - .writeAttribute("value"_sr, m_config->rngSeed()); - } } // Write test cases diff --git a/src/catch2/reporters/catch_reporter_xml.cpp b/src/catch2/reporters/catch_reporter_xml.cpp index 4e2a9a34..8c3338cb 100644 --- a/src/catch2/reporters/catch_reporter_xml.cpp +++ b/src/catch2/reporters/catch_reporter_xml.cpp @@ -51,14 +51,11 @@ namespace Catch { std::string stylesheetRef = getStylesheetRef(); if( !stylesheetRef.empty() ) m_xml.writeStylesheetRef( stylesheetRef ); - m_xml.startElement( "Catch2TestRun" ); - if( !m_config->name().empty() ) - m_xml.writeAttribute( "name"_sr, m_config->name() ); + m_xml.startElement("Catch2TestRun") + .writeAttribute("name"_sr, m_config->name()) + .writeAttribute("rng-seed"_sr, m_config->rngSeed()); if (m_config->testSpec().hasFilters()) m_xml.writeAttribute( "filters"_sr, serializeFilters( m_config->getTestsOrTags() ) ); - if( m_config->rngSeed() != 0 ) - m_xml.scopedElement( "Randomness" ) - .writeAttribute( "seed"_sr, m_config->rngSeed() ); } void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { |