MCPcopy Create free account
hub / github.com/Project-LemonLime/Project_LemonLime / initTestCase

Method initTestCase

tests/test1/main.cpp:131–162  ·  view source on GitHub ↗

Called once before all tests

Source from the content-addressed store, hash-verified

129 private slots:
130 // Called once before all tests
131 void initTestCase() {
132 // Initialize the spdlog logger that all Lemon LOG/DEBUG macros use.
133 // Without this, the inline shared_ptr `Lemon::base::logger` is null
134 // and any Settings setter that calls DEBUG() will crash.
135 auto console_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
136 console_sink->set_level(spdlog::level::info);
137 Lemon::base::logger = std::make_shared<spdlog::logger>(spdlog::logger("test", {console_sink}));
138
139 m_contestDir = QString(TEST_DATA_DIR) + "/TestContest1";
140 QVERIFY2(QDir(m_contestDir).exists(),
141 qPrintable(QString("Test data dir not found: %1").arg(m_contestDir)));
142
143 // Create a working copy of the contest data for judging tests
144 // (judging writes compiled binaries, so we don't want to pollute the original)
145 QVERIFY(m_tempWorkDir.isValid());
146 const QString dst = m_tempWorkDir.path() + "/TestContest1";
147 QDir().mkpath(dst);
148
149 auto copyDir = [](const QString &src, const QString &dst_, auto &selfRef) -> void {
150 QDir srcDir(src);
151 QDir().mkpath(dst_);
152 for (const QFileInfo &fi :
153 srcDir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)) {
154 const QString dn = dst_ + "/" + fi.fileName();
155 if (fi.isDir())
156 selfRef(fi.absoluteFilePath(), dn, selfRef);
157 else
158 QFile::copy(fi.absoluteFilePath(), dn);
159 }
160 };
161 copyDir(m_contestDir, dst, copyDir);
162 }
163
164 // ------------------------------------------------------------------
165 // Test 1: read CDF file

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected